This topic is locked

Difference between $_POST and $_REQUEST

6/24/2008 5:31:59 AM
PHPRunner General questions
M
mnhuda author

Hello,

I see that the variables $_POST and $_REQUEST have some common elements such as, both contain the input variable-values of the form. However $_REQUEST has some extra elements like usename, password. I want to know, 1) does $_POST contain only the input variables of the current form? 2) from where does $_REQUEST get its elements? I see that $_REQUEST is commonly used. mastertable is drawn from $_POST while masterkeys are checked from $_REQUEST. 3) which of them should I use (when)? and finally 4) what are the differences between them?

S
steveh 6/24/2008

You want to take a look at the php website (www.php.net) as this is a php question.
But in a nutshell, $_POST is the info from a form with a method of POST, $_GET is from a form with as method of GET (which then forms a URL e.g. a.php?a=b&c=fred)
$_REQUEST is the amalgamation of the two.