Method is an attribute that specifies how data is sent to the server. Actually, it is used to submit data. The following example shows how to use and pay attention to the method attribute of Form forms, if you are interested, refer to the attribute 1 method that specifies how data is sent to the server.
2 may only be post and get post: the official explanation is to transmit data to the server through the post session. Actually, data is submitted. Get: add the data in the form to the URL pointed to by action in the form of variable = value, and use "?" And variables are connected by "&". It is generally used to get data from the server.
3. The default value is get, so we usually need to specify it as post.
For example:
For example, if there are two pages, a.htmand B .asp, you want to pass the values in the.htm page form to the B. asp page.
In a.htm, there will be the following form code:
The Code is as follows:
Note the following two points in the above Code:
1. The property of method is get, so the value is visible through the URL;
2. There are two objects in the form, one text box and one submit button. The value of the text box must be passed. Change the id attribute of the text box to the name attribute so that the value of the text box can be displayed at the URL.
When you browse the.htm page and click the submit button, the page goes to the B. asp page and the URL changes:
Http: // localhost/WebSite2/B. asp? Text1 = 11
If you do not want the value to be displayed at the url, replace the method value with post.
Then in B. asp, you can obtain the passed value through the server code.
When method = get, the B. asp page obtains and outputs the value through <% = Request. QueryString ["Text1"] %>;
When method = post, the B. asp page obtains and outputs the value through <% = Request. Form ["Text1"] %>.