In this tutorial you will learn about the PHP GET & POST and its application with practical example.
PHP GET & POST are information passing mechanism. PHP GET & POST methods are used to submit or pass form data to the web server. Information is encoded using the Url Encoding method in which key/value pairs are joined with equal signs and different pairs are separated by the ampersand, spaces are removed and replaced with the + character and other non-alphanumeric characters are replaced with a its hexadecimal values.
The GET Method
The GET method appends the encoded user information to the query string. The page and the encoded information are separated by the ? character.All variable names and values are visible in URL.
Note: This method should not be used when submitting sensitive information!
GET method allows bookmark the page. This can be useful in some cases like search.The get method is not suitable for very large variable values. It s length should not exceed 1024 characters.
The PHP provides $_GET super global array to access information sent using GET method.
The POST Method
The POST method transfers encoded form information via HTTP headers to the web server.Information sent from a form by the POST method is more secured and has no restriction over the amount of information to be passed.
The PHP provides $_POST super global array to access information sent using POST method.
The $_REQUEST variable
PHP $_REQUEST variable can be used to access the contents of both $_GET, $_POST at same time.