Monday, March 22, 2010

Request.QueryString in asp

The Request.QueryString command is used to collect values in a form with method="get".
Information sent from a form with the GET method is visible to everyone (it will be displayed in the browser's address bar) and has limits on the amount of information to send.
If a user typed "Bill" and "Gates" in the HTML form above, the URL sent to the server would look like this:
http://www.w3schools.com/simpleform.asp?fname=Bill&lname=Gates
Assume that "simpleform.asp" contains the following ASP script:

Welcome
<% response.write(request.querystring("fname")) response.write(" " & request.querystring("lname")) %>

The browser will display the following in the body of the document:
Welcome Bill Gates



Examples

A form with method="get"
How to interact with the user, with the Request.QueryString command.




Your name:


<% dim fname fname=Request.QueryString("fname") If fname<>"" Then
Response.Write("Hello " & fname & "!
")
Response.Write("How are you today?")
End If
%>