|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
help again plz
what ever i do the response is: 'not good'
whats wrong? set c2=Server.CreateObject("ADODB.connection") set r2=Server.CreateObject("ADODB.recordset") c2.Open "DBQ= " & server.MapPath ("forum.mdb")& "; Driver={Microsoft Access Driver (*.mdb)};" r2.CursorType=adOpenKeyset r2.open "member", c2,3,3 dim id,un,fn,ln,pass,mal,age,add id=Request.Form("tetx1") un=Request.Form("text2") pass=Request.Form("password1") mal=Request.Form("tetx1") fn=Request.Form("text5") ln=Request.Form("text6") age=Request.Form("tetx7") add=Request.Form("text8") if id<>"" and un<>"" and pass<>"" and mal<>"" and fn<>"" and ln<>"" and age<>"" and add<>"" then r2.AddNew r2("userid")=id r2("nick")=un r2("password")=pass r2("email")=mal r2("fname")=fn r2("lname")=ln r2("year")=age r2("address")=add r2("dateadd")=date() r2.Update Response.Write "good" else Response.Write "not good" end if r2.Close set r2=nothing c2.Close set c2=nothing |
|
#2
|
|||
|
|||
|
Hi !
U sure these are correct --- > id=Request.Form("tetx1") un=Request.Form("text2") pass=Request.Form("password1") ---> mal=Request.Form("tetx1") fn=Request.Form("text5") ln=Request.Form("text6") ---> age=Request.Form("tetx7") add=Request.Form("text8") Thanks Suhail kaleem |
|
#3
|
|||
|
|||
|
when posting, please use acceptable titles, many are less willing to help with titles like this, read the sticky at the top for more info.
|
|
#4
|
|||
|
|||
|
i'm sure its correct.
why would it be incorrect? |
|
#5
|
|||
|
|||
|
If a text field is blank, it won't return "", it will be empty or null, which is <> ""
|
|
#6
|
|||
|
|||
|
when you have HUUUUUGEE if statements like this were it depends on so many values like this and you're not getting the results you want, step one is as doug implies displaying each item to see if one of the values is not coming through as expected and which one to isolate it rather then going, oh crap, my program doesn't work, why?
|
|
#7
|
|||
|
|||
|
well, i did what u said, but stilll got probs.
if the condition is : if id="" then respose.write "not good" else response.write "good" no matter what i do, the result is "not good" and if the condition is: if id<>"" then response.write "not good" else response.write "good" no matter what i do the result is "good" why? |
|
#8
|
|||
|
|||
|
huh? just do
response.write Request.Form("tetx1") response.write Request.Form("text2") response.write Request.Form("password1") response.write Request.Form("tetx1") response.write Request.Form("text5") response.write Request.Form("text6") response.write Request.Form("tetx7") response.write Request.Form("text8") my other question is why do you assign id=Request.Form("tetx1") mal=Request.Form("tetx1") this value to the a different variable? |
|
#9
|
|||
|
|||
|
how does doing it solve my problem?
the variables make the code easier to be understood. |
|
#10
|
|||
|
|||
|
not really, in fact not at all. You've completely confused yourself and it's plainly obvious if you would just write out what the value of the variable is. Once you do you'll see why you have those results in the if statements you wrote... you have a value associated with id, so of course those values print out what they do.
If you printed the variables out they'd say "bob" or whatever else you assigned to them... it's up to you if you want to do it your way but you've spent a lot of time coding that and messing with your variables when if you just printed out the variables to the screen you'd see which variable is screwing up your if statement. There's really not much more i can do here than say that. And if you want to assign them to variables that's fine, it's just more to remember in my opinion, i think it's easier/safer to work with the response.form("") elements since they're read only and you just have to remember the name of the text box and not the variable as well. I was just recommending you print the variable out to the screen rather than deal with if then 's and good stuff, i'm not sure why you'd want to do that rather then just writing out the variables. my other point earlier was that you assigned the same value to 2 different variables, that's odd and was making sure you knew you were doing that. |
|
#11
|
|||
|
|||
|
i noticed the double thing- thanx.
i changed the code and now it looks like this: if Request.Form("tetx1")="" then Response.Write "good" else response.write Request.Form("tetx1") response.write Request.Form("text2") response.write Request.Form("password1") response.write Request.Form("tetx4") response.write Request.Form("text5") response.write Request.Form("text6") response.write Request.Form("tetx7") response.write Request.Form("text8") end if but the result is ALWAYS: "good". its like the if doesnt even exist, why ? thanx |
|
#12
|
|||
|
|||
|
ack, we just can't get you off those if statements.
are you posting to this page? Because you have a form maybe it's this one or whatever, but when you hit submit on whatever page, that page HAS to point to this page and it HAS to be a post NOT a get. secondly, make sure you're text field is in fact called tetx1 and not text1 or something like that. i think before the if statement if you would just put Code:
response.write "TEXT 1:::" & request.form("tetx1") & ":::<br>"
that'd solve ALL of your problems, but you're bent on this if statement for some reason. This value is clearly not being set, this page is not being posted to, or you misspelled the textbox name. i assume you're smart enough to put all this code in <% %> tags and in a .asp extension? |
|
#13
|
|||
|
|||
|
thanx!!!
the problem was that i wrote 'tetx1' instead of 'text1'. i cant believe i spent the whole day on this. thank you vey much |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > help again plz |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|