The difference between a GET request and a POST request in HTML

Source: Internet
Author: User

First, the request is set in HTML by method, where the action is to set the page that accepts the HTML data.

<span style= "FONT-SIZE:18PX;" >

Get is a request to send data to the server.

Post is a request to submit data to the server.

Get gets information that is passed after the requested parameter is followed by the URL in the browser's address bar (interpreted Url:uniformresource Locator, which has its own URL for each file on the Internet).

For example: Http://zhidao.baidu.html? Fr=chd&test=1 this one in "? The following is the value of the parameter obtained through the URL. The "&" connection is used between FR and test, which is the parameter and parameter.

If you use get to pass a value in your application, you will need to use the request.querystring["parameter name" below as an example in the brisket:

The title column is a hyperlink, when the mouse moves to the title "KKK", the serial number is "16" link above, in the bottom left corner of the page will display a column of words, this column is the next page to open the URL, where "? "After"? Newsid=16 ", this is the parameter and parameter value after the URL.


Because all the data after us are in the database, News page no exception is also in the database, the title column of this page each title is a link will open a page to display the content of the news, but how to determine the click of a title to display the corresponding news content, is based on the newid parameter in the URL.

There is a hyperlink in the title so when you click it, the News content page (newscontent.aspx) is loaded, and the variable defined in Newscontent.aspx uses the following code to get the parameter "16" from the URL NewSID

string NewSID = request.querystring["NewSID"];

Then write the method in the D layer, find the news according to the news ID number, use the defined string variable NewSID as the parameter, and the last displayed page is as follows.


The POST request is sent to the Web server as the content of the HTTP message, and it is not visible to us that each field in the form is placed with its value in the header (message header) placed in the HTML, along with the URL address referred to by the Action property. The value is generally obtained using the request.form["parameter name" or Request.Form.Get ("parameter name") in the specified URL.

Summary

Get request method because the home data is placed behind the URL, it is relatively unsafe, and can carry the size of the data is limited. And the post is not affected by such a display, in use, according to the actual situation to choose the right Method!



The difference between a GET request and a POST request in HTML

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.