Re: mixing $_POST and $_GET vars
| From: | afan@afan.net | Date: | Fri, 09 Sep 2005 23:49:53 +0000 |
| Subject: | Re: mixing $_POST and $_GET vars | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-222106@lists.php.net to get a copy of this message | ||
Request variables: $_REQUEST
*Note: * Introduced in 4.1.0. There is no equivalent array in
earlier versions.
*Note: * Prior to PHP 4.3.0, $_FILES information was also included
in $_REQUEST.
An associative array consisting of the contents of $_GET, $_POST, and $_COOKIE.
This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. You don't need to do a *global $_REQUEST;* to access it within functions or methods.
If the register_globals <http://us2.php.net/manual/en/ini.core.php#ini.register-globals> directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the $_REQUEST array. For related information, see the security chapter titled Using Register Globals <http://us2.php.net/manual/en/security.globals.php>. These individual globals are not autoglobals.
http://us2.php.net/reserved.variables
-afan
bruce wrote:
hi.. quick question.. a basic link <a ref ="foo.php?a=1">blah</a> allows you to process the vars in foo.php using $_GET, easy/basic enough. however, if i have a form from cat.php that does a 'post' of the form information/input to the foo.php, i'm then going to have to either change the form to do a 'get' or else i'm going to have to do both a $_GET, and a $_POST within foo.php to access the vars from the pages that are interfacing with foo.php. is there an easier/cleaner/better approach?? or do i really need/wind up doing something like if ($_GET['foo'])... if ($_POST['apple'])... and just have a mix of both methods within the code... thanks -bruce bedouglas@earthlink.net