To access request variables directly in PHP
To access request variables directly. Here are three methods:-
1. Turn on register_globals in php.ini, but remeber "This feature has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged."
ex:=> http://localhost/phptest/extract.php?name=Jhon
Your file extract.php.
//Method 2nd
extract($_GET);
extract($_POST);
echo "
";
echo $name;
//method 3rd
// This will import GET and POST vars
// with an "rvar_" prefix
import_request_variables("gp", "rvar_");
echo "
";
echo $rvar_name;
?>
1. Turn on register_globals in php.ini, but remeber "This feature has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged."
ex:=> http://localhost/phptest/extract.php?name=Jhon
Your file extract.php.
//Method 2nd
extract($_GET);
extract($_POST);
echo "
";
echo $name;
//method 3rd
// This will import GET and POST vars
// with an "rvar_" prefix
import_request_variables("gp", "rvar_");
echo "
";
echo $rvar_name;
?>

Leave a Comment