note 29248 added to language.variables.predefined

From: Date: Fri, 07 Feb 2003 12:22:27 +0000
Subject: note 29248 added to language.variables.predefined
Groups: php.notes 
Request: Send a blank email to php-notes+get-43549@lists.php.net to get a copy of this message
Not long ago I had a problem understanding how the $_GET works, so I create this little PHP program to help me understand better. Let's say you have a file index.php and you are accessing it with few variables in the addrress (index.php?type=show&sort=desc&foo=bar). Now, the question you wondering is how to access that variables? You could use $type, $sort and $foo in this example... but what if register_globals are off? Then, you need to access them with other function... <?php echo "Test for URL varibles using \$HTTP_GET_VARS[\"op\"]<P>"; if (isset($HTTP_GET_VARS["op"])) { echo "var op = ".$HTTP_GET_VARS["op"]."<P>"; } echo "<a href=\"url_varibles.php?op=test_sucess\">URL Variable Link</a>"; //---------------------------------------------------------- echo "<P><HR>Test for URL varibles using \$_GET['type']<P>"; echo "<a href=\"url_varibles.php?type=show&sort=desc&foo=bar\">URL Variable Link</a>"; if (isset($_GET['type'])) { echo "<P>Here are our variables: <br >\n"; echo "1. ". $_GET['type'] ."<br />\n"; echo "2. ". $_GET['sort'] ."<br />\n"; echo "3. ". $_GET['foo'] ."<br />\n"; } ?> -- http://www.php.net/manual/en/language.variables.predefined.php http://master.php.net/manage/user-notes.php?action=edit+29248 http://master.php.net/manage/user-notes.php?action=delete+29248 http://master.php.net/manage/user-notes.php?action=reject+29248

« previous php.notes (#43549) next »