Using ASP you can process information gathered by an HTML form and use ASP code to make decisions based off this information to create dynamic web pages
To retrieve information from forms, like user input the Request.QueryString and Request.Form commands may be used
An ecommerce site could take the user's information and store it into a database named user.
This information could then be used to prepopulate the shipping information when the user is ordering another product
By taking the title and body a forum might save the user's post to a forum and saving it to a file so that it can then be called later when someone wants to view it
Create an HTML Form
You need to create an HTML form that will send information to your ASP page,before processing the information.
For sending data to an ASP form there are two methods named GET and POST.
In your HTML Form element's Method attribute,these two types of sending information are defined . Also, the location of the ASP web page must be specified that will process the information
Below is a simple form that will send the data using the GET method. Copy and paste this code and save it as as "vyomForm.html".
vyomForm.html Code:
<form method="GET" action="vyomFormProcess.asp">
Name <input type="text" name="Name"/>
Age <input type="text" name="Age"/>
<input type="submit" value="Submit Query" />
</form>
O/P:
Name:
Age:
Form Example in ASP Using Method="get"
<html>
<body>
<form action="demo_reqquery.asp" method="get">
Your name: <input type="text" name="fname" size="20" />
<input type="submit" value="Submit" />
</form>
<%
dim fname
fname=Request.QueryString("fname")
If fname<>"" Then
Response.Write("Hello " & fname & "!<br />")
Response.Write("How are you today?")
End If
%>
</body>
</html>
O/P:
Your Name:
Results:
Hello Vyom!
How are you today?
Request.QueryString
To collect values in a form with method="get",the Request.QueryString command is used .
Information sent from a form with the GET method has limits on the amount of information to send and is visible to everyone (it will be displayed in the browser's address bar) .
In the form example above,if a user typed "Martin" and "Luther" , the URL sent to the server would look like this: