note 45805 deleted from reserved.variables by betz
| From: | betz@php.net | Date: | Wed, 15 Dec 2004 22:05:21 +0000 |
| Subject: | note 45805 deleted from reserved.variables by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-81834@lists.php.net to get a copy of this message | ||
Note Submitter: vorlin at tampabay dot rr dot com
----
Just a note on $_REQUEST variables, especially in concern with $_GET and $_POST.
If you have two variables of the same name, one using GET (url assignment) and the other inside a
form set for POST (hidden input for example), if you try to read the variable through $_REQUEST,
you'll only ever get the $_POST result.
While it's easier to use $_REQUEST for variables only assigned to one area (POST/GET/COOKIE),
to bypass the above problem in situations where the same variable might be called in two formats
(GET/POST), one could do the following:
<?php
$testVar = isset($_POST['testVar']) ? $_POST['testVar'] :
$_GET['testVar'];
?>