What is _POST in PHP

With the form attribute “method” we have the choice between “get” and “post”, depending on which we choose, we have to access the variable “$ _GET” or “$ _POST” in the PHP script. But what is the difference between the two?

GET is shown in the URL

When we send a form with "get", the variable + its value is displayed in the URL line of the browser:

The user can manipulate this value, but $ _POST is no protection against it, but in most cases it looks "nicer" because the URL line is not pumped full of variables.

GET is limited, POST is not

Especially when you have a form field in which a lot of data can come in (e.g. a blog article, a forum post, a Wikipedia article) you have to use POST, as the get method is limited. Or actually "get" is not limited, but the url line of the browser. Depending on the browser, you have a maximum length of 1024 characters and this is usually not sufficient for articles (yes for twitter messages;))

Advantages and disadvantages of post and get

Here again the advantages and disadvantages summarized:

  • With GET, the user sees which data is being transferred (can be seen as an advantage or a disadvantage)
  • The length is limited with GET, not with POST
  • The results page of a GET form can be bookmarked because all the necessary information is contained in the URL
  • The results page of a POST form cannot be bookmarked or updated in the browser because the data is no longer available
  • File upload is only possible with POST

source