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

Recommended Answers

All 3 Replies

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:

$_REQUEST=array_merge($_POST,$_GET);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.