ASP and HTML forms for ASP learning

Source: Internet
Author: User
Tags html form

In ASP, there are two very common collections, one is Request.QueryString, the other is Request.Form. These two collections can get information submitted by HTML Forms (HTML forms).

Request.QueryString

There are two kinds of method in an HTML form, one is get and the other is post. When an HTML form is method= "get", you can use Request.QueryString to obtain information about the form submission.

The following is an example of an HTML form that lets users enter names.

<form action="yourname.asp" method="get">
请输入你的姓名:
<input type="text" name="yourname">
<input type="submit" value="提交">
</form>

The information submitted.

In the example, the method used in the HTML form is get, and the page that points to the action is an. asp file with the name yourname.asp. The following is the source code for the yourname.asp file:

<title>姓名信息</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<body>
<p>你的姓名是:<%= Request.QueryString("yourname") %></p>
</body>

In this. asp file, you can see that the most critical code is:

<p> your name is: <%= request.querystring ("Yourname")%></p>

The "Yourname" in the request.querystring brackets corresponds to the name value of the Input entry box in the HTML form.

When submitting form information using method= "Get", users can see these submissions from the address bar.

Request.Form

When method = "POST" in an HTML form, you can use Request.Form to get information about the HTML form submission.

Collection). Request.Form.

The following is an example of an HTML form that lets the user enter a name and password.

<form action="userpw.asp" method="post">
请输入你的姓名:<input type="text" name="yourname"><br>
请输入你的密码:<input type="password" name="yourpw"><br>
<input type="submit" value="提交">
</form>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.