Difference between Get requests and Post requests in HTML, htmlgetpost requests

Source: Internet
Author: User

Difference between Get requests and Post requests in HTML, htmlgetpost requests

First, set the Request method in HTML using method, and the action is to set the page for receiving HTML data.

<span style="font-size:18px;">

Get is a request to request data from the server.

Post is a request to submit data to the server.

 

Get gets information, and the request parameters will be transmitted along with the URL in the browser's address bar (interpreted URL: UniformResource Locator, each file on the Internet has its own URL.

Example: http://zhidao.baidu.html? Fr = chd & test = 1 in "?" The value of the parameter is obtained through the URL. The "&" connection is used between the fr and test parameters.

If you use Get to transmit values in an application, you need to use Request. QueryString ["parameter name"] as follows:

The title column is a hyperlink. When you move the cursor over the link with the title "kkk" and serial number "16", a column of words is displayed in the lower left corner of the page, this column is the URL of the next webpage to be opened, where "?" After "? Newsid = 16 ", which is the URL parameter and parameter value.


Because all the subsequent data is stored in the database, and news pages are stored in the database without exception. Each title in the title column of this page is a link and a new page is opened to display news content, but how to determine how to click 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), in NewsContent. aspx defines variables and uses the following code to obtain the parameter "16" from newsid in the URL"

String newsid = Request. QueryString ["newsid"];

Then, write the method in layer D, search for news by news ID, and use the defined string variable newsid as the parameter during use. The following page is displayed.


A Post request is sent to the web server as the content of an http message. Each field and its value in the form are placed in the Header of the HTML (message Header) we can't see this process from the URL address transmitted to the ACTION attribute. In a specified URL, the value is generally obtained using Request. Form ["parameter name"] or Request. Form. Get ("parameter name.

Summary

The Get request method is relatively insecure because the home data is placed behind the URL, and the data size that can be carried is limited. Post is not displayed in this way. You must select an appropriate method based on your actual situation!



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.