|
In ASP you can gather information from HTML Form and use ASP code to process this information to make dynamic web pages. The Request object can be used to retrieve the information from HTML forms.
Request.QueryString
Request.QueryString command is used to get the information of the html form if html form is sending the data using GET method.
Information sent from a form with the GET method is visible in the browser’s address bar also it has limits on the amount of information to send.
Here is a simple HTML form with Get method.
<form name="frmuser" id="frmusr" method="get" action="getuserinfo.asp">
User Name: <input type="text" name="username" /><br />
User Age: <input type="text" name="userage" /><br />
User Country: <input type="text" name="usercountry" /><br />
<input type="submit" value="Submit" />
</form>
Retrieving the form values using Request.QueryString
<%
DIM username, age, country
username = Request.QueryString("username")
userage = Request.QueryString("userage")
usercountry = Request.QueryString("usercountry")
Response.Write("User Name = " & username & "<br>")
Response.Write("User Age = " & userage & "<br>")
Response.Write("User Country = " & usercountry & "<br>")
%>
Request.Form
Request.Form command is used to get the information of the html form if html form is sending the data using POST method.
Information sent from a form with the POST method is not visible in the browser’s address bar it has no limits on the amount of information to send.
Here is a simple HTML form with Get method.
<form name="frmuser" id="frmusr" method="post" action="getuserinfo.asp">
User Name: <input type="text" name="username" /><br />
User Age: <input type="text" name="userage" /><br />
User Country: <input type="text" name="usercountry" /><br />
<input type="submit" value="Submit" />
</form>
Retrieving the form values using Request.Form
<%
DIM username, age, country
username = Request.Form("username")
userage = Request.Form("userage")
usercountry = Request.Form("usercountry")
Response.Write("User Name = " & username & "<br>")
Response.Write("User Age = " & userage & "<br>")
Response.Write("User Country = " & usercountry & "<br>")
%> |