| Home Contact Us Advertising |
![]() |
|
||||
ASP Guides ASP Install ASP Syntax ASP Variables ASP Procedure ASP Forms ASP CookiesASP Session ASP Application ASP IncludeASP Send Email Link Partners
|
ASP Forms and User InputThe Request.QueryString and Request.Form commands may be used to retrieve information from forms, like user input. User InputThe Request object may be used to retrieve user information from forms. Form example:
User input can be retrieved in two ways: With Request.QueryString or Request.Form. Request.QueryStringThe 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 form example above, the URL sent to the server would look like this:
Assume that the ASP file "simpleform.asp" contains the following script:
The browser will display the following in the body of the document:
Request.FormThe Request.Form command is used to collect values in a form with method="post". Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send. If a user typed "Bill" and "Gates" in the form example above, the URL sent to the server would look like this:
Assume that the ASP file "simpleform.asp" contains the following script:
The browser will display the following in the body of the document:
Form ValidationUser input should be validated on the browser whenever possible (by client scripts). Browser validation is faster and you reduce the server load. You should consider using server validation if the user input will be inserted into a database. A good way to validate a form on the server is to post the form to itself, instead of jumping to a different page. The user will then get the error messages on the same page as the form. This makes it easier to discover the error. |
Featured Sites |
| © 2005 Copyright - Zenaspfree.com |