search
  • Sign In
  • Sign Up
Password reset successful

Follow the proiects vou are interested in andi aet the latestnews about them taster

ASP form

Collection 17
Read 15266
update time 2016-09-11

The Request.QueryString and Request.Form commands are used to retrieve information from a form, such as user input.


tryitimg.gif

Try it - Example

Use method="get" form
This example demonstrates how to use the Request.QueryString command with the user to interact.

Form using method="post"
This example demonstrates how to use the Request.Form command to interact with the user.

Forms using radio buttons
This example demonstrates how to use the Request.Form command to interact with the user through radio buttons.


User Input

The Request object can be used to retrieve user information from a form.

HTML Form Example

<form method="get" action="simpleform.asp">
First Name: <input type="text" name ="fname"><br>
Last Name: <input type="text" name="lname"><br><br>
<input type="submit" value="Submit">
</form>

User input can be retrieved through the Request.QueryString or Request.Form command.


Request.QueryString

The Request.QueryString command is used to collect values ​​from a form using method="get".

Information transferred from a form using the GET method is visible to all users (appears in the browser's address bar), and there are limits on the amount of information sent.

If the user enters "Bill" and "Gates" in the above HTML form, the URL sent to the server will be similar to this:

http://www.w3cschool.cc /simpleform.asp?fname=Bill&lname=Gates

Assume the "simpleform.asp" file contains the following ASP script:

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

The browser will display the body part of the document as follows:

Welcome Bill Gates


Request.Form

The Request.Form command is used to collect values ​​from a form using method="post".

Information transferred from a form using the POST method is invisible to the user, and there is no limit on the amount of information sent.

If the user enters "Bill" and "Gates" in the above HTML form, the URL sent to the server will be similar to this:

http://www.w3cschool.cc /simpleform.asp

Assume that the "simpleform.asp" file contains the following ASP script:

<body>
Welcome
<%
response.write(request.form( "fname"))
response.write(" " & request.form("lname"))
%>
</body>

The browser will Display the body part of the document as follows:

Welcome Bill Gates


Form Validation

Whenever possible, try to Validation of user input on the browser (via client-side script). Browser validation is faster and reduces server load.

If user input will be saved to a database, then you should consider using server-side validation. A good way to validate a form on the server side is to pass the (validated) form back to the form page instead of going to a different page. Users can then get incorrect information on the same page. This makes it easier for users to find errors.


Hot AI Tools
Undress AI Tool
Undress AI Tool

Undress images for free

AI Clothes Remover
AI Clothes Remover

Online AI tool for removing clothes from photos.

Undresser.AI Undress
Undresser.AI Undress

AI-powered app for creating realistic nude photos

ArtGPT
ArtGPT

AI image generator for creative art from text prompts.

Stock Market GPT
Stock Market GPT

AI powered investment research for smarter decisions

Popular tool
Notepad++7.3.1
Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version
SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1
Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6
Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version
SublimeText3 Mac version

God-level code editing software (SublimeText3)