Posted 16 August 2006 - 11:14 PM
Posted 16 August 2006 - 11:27 PM
Same for $_POST but form method="post"
$_REQUEST is an array containing values from either of these methods - I do use it sometimes but very rarely....
Posted 16 August 2006 - 11:32 PM
$_POST is used when what you are looking for is passed using the POST method of the form the data was sent from.
$_REQUEST wraps both $_GET and $_POST, and some other things too.
Now, for a bit of an explanation: When you use the POST method in your form, like this:
<form name="myForm" action="handleMyForm.php method=[color=red]"POST"[/color] <input type="text" name="myInput"> <input type="submit" name="submit" value="Submit"> </form>you should use the $_POST syntax in the script handling the form:
... $myInput = $_POST['myInput']; ...
Likewise, if you use the GET method in the form, you should use the $_GET syntax in the form handling script.
$_REQUEST will find both GETs and POSTs, but you should really stick with $_GET or $_POST. If you must use $_REQUEST, and if a GET value and a POST value both have the same name attribute on the form, the variable will be overwritten. The order of precedence is specified in php.ini. I'll leave it as an excercise to you to find the line in the ini file, and learn what the default order of precedence is.
Hope this helps...
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users