ASP php Tutorial: Creating Forms


ASP Forms

There are two methods to retrieve information from the form :

  • By using Request.QueryString
  • By using Request.Form

 

The Request.QueryString command is used to collect values in a form with method =”get”.
Information sent from a form with GET method can be viwed by everyone as it is displayed in the address bar of the browser.
There are limits on the amount of information to be sent.


The Request.Form  command is used to collect values in a form with method =”post”.
Information sent from a form with GET method can NOT be viwed by everyone as it is NOT displayed in the address bar of the browser.
There are NO limits on the amount of information to be sent.


A Form with the GET method
<html><body>
<form method=get action=”pg.asp”>
<label>Enter name :
<input type=”text” name=Name><label>
<br>
<label>Enter age :
<input type=”text” name=Age><label>
<br>
<input type=”submit” value=”send”>
</form></body></html>
The Request.QueryString command is used to collect values in a form with method =”get”.
Information sent from a form with GET method can be viwed by everyone as it is displayed in the address bar of the browser.
There are limits on the amount of information to be sent.


“pg.asp”
This is an ASP file to retrieve the information from the form.
<%@language=”JavaScript”%>
<%
Var nam,ag
Nam=Request.QueryString(“Name”)
Ag=Request.QueryString(“Age”)
%>
<html>
<body>
Hello
<%Response.Write(Nam)%>
<br>
Your age is :
<%Response. Write(Ag)%>
</body></html>


FORM VALIDATION

    • The input by the user must get validated on the browser in most cases. This validation is faster and the load on the server is drastically reduced.
    • Server validation must be used if the user input will be inserted into a database.

    asp tutorials