The request object in ASP is a very important object to get the client to submit the data, everybody is very familiar to him too.
Even so, people often ask me how the following kinds of writing are different, in the end how to write?
strmessage = Request ("msg")
strmessage = Request.Form ("msg")
Also, I have seen many people write code, all are request (""), of course, this writing is not wrong.
It's just that you should pay attention to the request object has several sets to obtain the data submitted by the client, commonly used Querystring,form and ServerVariables.
And no matter what kind of collection can actually be obtained directly from the request (""), there is a problem here, if the Get method and post method submitted the same variable, such as USERNAME=CQQ, then you use Request ("username") Did you get the data that came out of you or did you post it?
So, the problem here, we should think of, request from these several sets of data is in order, the former to the following order is Querystring,form, and finally is servervariables. The request object, in this order, searches for the variables in these sets, and if there is a match, the rest is terminated. So the above example request ("username") takes the actual data submitted by the Get method.
Therefore, in order to improve efficiency, reduce the unnecessary search time, but also for the Code of Procedure, we suggest that we still use request. The way to assemble is better, such as Request.Form ("username").
Here is a test example, after the submission, you can directly after the address of the add? USERNAME=AAA to test:
<%
if Request ("submit") <> "" Then
response.write "direct fetch:" & Request ("username") & "<br>"
response.write "Fetch get:" & Request.QueryString ("username") & "<br>"
Response.Write "Take post:" & Request.Form ("username") & "<br>"
End If
%>
<form Name=form1 AC Tion= "" Method=post>
<input type=test name= "username" value= "postuser"
<input type=submit "Name=" Submit "value=" "Test"
</form>