When you submit data by using the form's post, the data in the form is saved in the form collection of the Request object. The syntax format for passing data using the form collection is as follows:
Request.Form (元素名) [(索引值)|.表单某元素的个数]
Note: The element name is the form element (control) name that the form collection is to retrieve, and the index value specifies one of the multiple values of the form element. For example, a checkbox, select, and other control objects, you want to specify a value to use the index value; When you use the form collection to read parameters, the corresponding HTML in the page of the form's method attribute must be set to Post only, otherwise you will not be able to read the parameters. The form collection in the Request object is a child object in the Request object, and form is the label name of the form in the HTML page. The former receives information submitted by the latter through the Post method.
Read the value of a specific element object in the Form collection
Below is a list of basic situations that a recruiter needs to be filled out by a recruiter. The code for submitting the form is as follows (file name: 4-3a.htm):
<body>
<p align=center> input Data form
<form action= "4-3a.asp" method= "POST" >
<table Align=center border=1>
<tr valign=baseline>
<td> Name: <input type= "text" Name= "XM" size=8>
<td> Sex: Male <input type= "Radio" name= "XB" value= "male" checked>
Female <input type= "Radio" name= "XB" value= "female" >
<td> Password: <input type= "Password" name= "MM" size=12>
<TR><TD colspan=3> majored in science
<input type= "Checkbox" name= "Ah" value= "Chinese" > Chinese
<input type= "Checkbox" name= "ah" value= "Japanese" > Japanese
<input type= "Checkbox" name= "Ah" value= "Spanish" > Spanish
<input type= "Checkbox" name= "Ah" value= "English" > English
<input type= "Checkbox" name= "Ah" value= "German" > German
<tr><td> Specialty:<br>
<select name= "XL" style= "width:200px" size=4>
<option value= "Social" > Social
<option value= "Computer" > Computer
<option value= "Sports" > Sports
<option value= "Literary hobby" selected> literary hobby
<option value= "good management" > good at Management
</Select>
<TD colspan=2> Life Motto:<br>
<textarea name= "adage" cols=40 rows=4></textarea>
</table>
<p align=center><input type= "Submit" value= "submitted" >
<input type= "Reset" value= "Rewrite" >
</form>
</body>
The code to invoke the form handler is as follows: (file name: 4-3a.asp)
<body>
<center>
request 对象的form 集合示例<p>
<p><font color="red">下面是您所填写的基本信息,请确定是否正确。<p>
<%
Response.write("您的姓名是:" & Request.form("xm") & "<p>")
Response.write("您的性别是:" & Request.form("xb") & "<p>")
Response.write("您的密码是:" & Request.form("mm") & "<p>")
Response.write("您所学专业是:" & Request.form("ah") & "<p>")
Response.write("您的特长是:" & Request.form("xl") & "<p>")
Response.write("您的格言是:")
Response.write Request.form("adage") & "<p>"
%>
这些信息对吗?
<a href="4-3a.htm">如不对,返回</a>**||**<a href="4-3-2.asp">请点这里返回到教材</a></p>
<center>
</body>