php_joe Posted February 28, 2007 Share Posted February 28, 2007 The PHP manual says: Request variables: $_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 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. These individual globals are not superglobals. Which is interesting, but not very helpful for me. I could really use a simple example please. Thank you. Quote Link to comment Share on other sites More sharing options...
btherl Posted February 28, 2007 Share Posted February 28, 2007 Try the following to investigate: var_dump($_REQUEST); print_r($_REQUEST); foreach ($_REQUEST as $name => $value) { print "$name has value $value\n"; } Then call your script with some arguments, for example http://domain.com/script.php?something=this&another=somethingelse $_REQUEST will also include posted variables and cookies, in addition to GET variables (which is what is used in the example url above) Quote Link to comment Share on other sites More sharing options...
php_joe Posted February 28, 2007 Author Share Posted February 28, 2007 Thank you very much! Quote Link to comment Share on other sites More sharing options...
flappy_warbucks Posted February 28, 2007 Share Posted February 28, 2007 The PHP manual says: Request variables: $_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 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. These individual globals are not superglobals. Which is interesting, but not very helpful for me. I could really use a simple example please. Thank you. what i would do is this: <?php foreach($_REQUEST as $key => value) { echo "$key => $value<br>\n"; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.