Difference between $_POST and $_REQUEST
hi.. I just found out that using $_POST to access variables from a form can also be done using $_REQUEST that used to be used to access variables NOT from a form.
So, if I have a form with a textbox named "username", after the user press the submit button, I can access the variable username using $_POST['username'] and $_REQUEST['username'], they both will result the same.
But if I use a link like this "login.php?user=$username", you can only access the variable user using $_REQUEST['username'].
My question is, if to process forms they're both the same, why should I use $_POST instead of $_REQUEST? Why not just use $_REQUEST all the time? Does it have anything to do with register global?
thanks
Re: Difference between $_POST and $_REQUEST
$_REQUEST contains the aggregate contents of $_POST, $_GET, and $_COOKIE. You can use it if you don't give a stuff about where the variable comes from.
You should however still honour the semantic difference between GET and POST. GET is used for one way query requests - extracting data. POST is used for modifying data.