How to get the names of all forms and the corresponding values in Asp. In fact, this question is very simple, but there may still be many people who don’t know how to do it, so they wrote it down for reference only. In the Asp program, the object used to obtain client data is Request, which provides us with many methods and attributes. For example, there is such a Form,
<FORM METHOD=POST name=cqq ACTION="">
<INPUT TYPE="text" NAME="username">
<INPUT TYPE="text" NAME="password">
<INPUT TYPE="checkbox" NAME="sex" value="male">
<INPUT TYPE="checkbox" NAME="sex" value="female">
<INPUT TYPE="submit">
</FORM>
If we want to get the value in username, we can write it like this: Request.Form("username")
Everyone knows this. In fact, this Form is a collection, which means that all the contents in the form are stored in this collection
In this case, if we want to obtain the value of a certain element, we only need to set the name of the element in Request.Form(), for example
username above.
So, what about getting all the values in the set? That's very simple, just follow anything, just write Request.Form
You get the names and values of all elements in the collection. Here is a statement for operating a collection:
<%
For each obj in Request.Form
Response.write obj & " " & Request.Form(obj) & " <br>"
Next
%>