Javatpoint Logo
Javatpoint Logo

Difference between get and post method in PHP

The browser client can deliver data to the web server in two ways.

  • The GET Method
  • The POST Method

Before sending the data, the browser encrypts it using a method known as URL encoding. Name/value pairs are connected using equal signs in this system, while distinct pairings are separated by an ampersand. Spaces are substituted with the + symbol, and any other nonalphanumeric characters are replaced with hexadecimal values. After the data has been encoded, it is transferred to the server.

Now let us look at the individual methods and understand the working of these methods and understand them.

Get Method:


The GET method appends encoded user information to the page request. The? character separates the page from the encoded content.

  • The GET method generates a lengthy string that displays in your server logs and in the Location: box of your browser.
  • The GET method can only send up to 1024 characters.
  • If you need to send a password or other sensitive information to the server, never utilise the GET method.
  • GET cannot be used to deliver binary data to the server, such as photos or word documents.
  • The QUERY STRING environment variable can be used to obtain the data sent by the GET method.
  • PHP offers an associative array $_GET for accessing all information given via the GET method.


Post Method:

The POST method sends data to the server using HTTP headers. The information is encoded in the same way as specified for the GET method and included in a header named QUERY STRING.

  • The POST method has no limit on the amount of data that can be delivered.
  • The POST method allows you to submit both ASCII and binary data.
  • Because data submitted using the POST method is routed through the HTTP header, security is dependent on the HTTP protocol. You may ensure the security of your data by utilising Secure HTTP.
  • PHP offers an associative array $_POST for accessing all information given via the POST method.


Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA