How to get all the contents of a form in an ASP program-application Tips

Source: Internet
Author: User


How do I get the names of all the forms in ASP the corresponding value . In fact, the problem is very simple, but there may still be a lot of people do not know how to do, so specially written down for reference only. In an ASP program, the object used to obtain client data is Request, which provides us with a number of methods and attributes. For example, there is 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 this: Request.Form ("username")

This is everyone, in fact, this form is a collection, which means that all the content in the form is stored in this collection

In which we have to get the value of an element, we just need to set the name of the element here in Request.Form (), such as

Above the username.

So, what do we need to get all the values in the collection? That's simple, nothing to do with it, just write Request.Form .

Gets the name and value of all the elements in the collection. The following is a statement that operates on a collection:

<%
For each obj in Request.Form
Response.Write obj & "" & Request.Form (obj) & "<br>"
Next
%>


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.