View Full Version : 2 response.write(querystring....functions
Mhtml
07-24-2002, 06:05 AM
I am trying to make a users IP and Browser information come up on the screen if the users selects it from a form.
<%
If request.QueryString("browser") = "on" then
response.write(Request.ServerVariables("http_user_agent"))
else if request.QueryString("ip") = "on" then
response.write(Request.ServerVariables("remote_addr"))
end if
end if%>
not sure about the second end if statement, the error that came up before it was in the script told me to put it in.
Roelf
07-24-2002, 08:10 AM
I dont know what the problem is you encountered, but i would do it this way:
<%
If request.QueryString("browser") = "on" then
response.write(Request.ServerVariables("http_user_agent"))
end if
if request.QueryString("ip") = "on" then
response.write(Request.ServerVariables("remote_addr"))
end if
%>
You seem to have two separate checkboxes in your form so the printing of the ip shouldnt be dependant from the printing of the browsername
Mhtml
07-24-2002, 08:35 AM
Oh, Ok I see what you mean, I'm only new to this. Thanks.
allida77
07-24-2002, 01:45 PM
The problem was that you have two "end ifs" and your using "else if" not "elseif".
<%
If request.QueryString("browser") = "on" then
response.write(Request.ServerVariables("http_user_agent"))
ElseIf request.QueryString("ip") = "on" then
response.write(Request.ServerVariables("remote_addr"))
End If%>
whammy
07-26-2002, 11:38 PM
The problem with using ElseIf in this case, is if the first condition is true, it won't execute the second condition.
I'd go with roelf's way personally.
Mhtml
07-27-2002, 02:43 AM
hmmm....I was wondering why my scripts didn't work with else if. But now i know, thanks Allida77, Whammy + Roelf!.:thumbsup:
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.