PHP Tutorial: differences between passing values through POST and GET _ PHP Tutorial

Source: Internet
Author: User
Tags html header
PHP Tutorial: the difference between passing values through POST and GET. Q: I used the POST method in formactionsearch_result.phpmethodPOST, but why not use the GET method? First, let's take a look at the difference between POST and GET: When Post transmits data, don't ask: I used POST for the method, but why not use the GET method?

First, let's take a look at the difference between POST and GET values:

When Post is used to transmit data, it does not need to be displayed in the URL, but the Get method must be displayed in the URL. The size of Post data transmission can reach 2 MB, while the Get method can only transmit about 1024 bytes due to the limited URL length. In general, we use POST as the first choice, which is safer.

Differences between $ _ REQUEST, $ _ POST, and $ _ GET in PHP

All three methods are used to receive form data.

$ _ REQUEST uses the functions $ _ POST and $ _ GET, but $ _ REQUEST is slow. All data submitted through the POST and GET methods can be obtained through the $ _ REQUEST array.

Differences and features between $ _ POST and $ _ GET

1. GET is to GET data from the server, and POST is to send data to the server.

2. GET is to add the parameter data queue to the URL referred to by the ACTION attribute of the submission form. the values correspond to each field in the form one by one and can be seen in the URL. POST uses the http post mechanism to place fields in the form and their content in the html header and send them to the URL address referred to by the ACTION attribute. You cannot see this process.

3. for the GET method, the server uses Request. QueryString to obtain the value of the variable. for the POST method, the server uses Request. Form to obtain the submitted data.

4. the data volume transmitted by GET is small and cannot exceed 2 kB. The amount of data transmitted by POST is large, which is generally not restricted by default. Theoretically, the maximum size of IIS4 is 80 kB, and that of IIS5 is 100KB.

5. Low GET security and high POST security.

Using action = search_result.php method = post I used the POST method, but why not use the GET method? First, let's take a look at the difference between POST and GET: When Post transmits data, no...

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.