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>