Variables from outside PHP

5/30/2004 · 0 comments

in PHP & MySQL

Just a quick link to the documentation describing how to access GET, POST and cookie variables from PHP: PHP: Variables from outside PHP – Manual:


// Available since PHP 4.1.0

   echo $_POST['username'];
   echo $_REQUEST['username'];

   import_request_variables('p', 'p_');
   echo $p_username;

// Available since PHP 3. As of PHP 5.0.0, these long
// predefined variables can be disabled with the
// register_long_arrays directive.

   echo $HTTP_POST_VARS['username'];

// Available if the PHP directive register_globals = on. As
// of PHP 4.2.0 the default value of register_globals = off.
// Using/relying on this method is not preferred.

   echo $username;

Did you like this? Please share it:

Add to Twitter Add to Delicious Add to Facebook Add to Stumble Upon Add to Digg Add to Reddit Add to Yahoo Buzz

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post:

Next post: