Hi all,
was just wondering what is the difference between $_GET $_POST $_REQUEST?

I normally use $_REQUEST to get my values from a form or url, but not too sure why there is 3 different types. from what i understand, they are all the same and do the same thing right? Can anybody provide an example for these?

I know that the $_REQUEST is used for retrieving values from a form or url, but the other ones i don't know too much about.

Cheers all

5 Years
Discussion Span
Last Post by broj1

The $_GET is used to get variables from the URL.
eg URL: example.php?id=123 GET: $id=$_GET;

The $_POST is used to get variables from a form on the previous page
eg $id=$_POST[id'];

i have never used the $_request before becuase you can do pretty much do everything with the post and get.


$_GET is to get a variable from the url or a form method="GET" request like the previous post suggests.
$_POST get's a method="POST" request and is designed so that people can't read this data without a special addon or script which many people do for hacking reasons.
$_REQUEST is both $_GET and $_POST combined into the same array so it is the same as the following:

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.