eliter4v3n wrote:In the latest version of XAMPP i can not get any variables to work when they are either GET or just stated in the URL.
an example would be
- Code: Select all
<?php
echo("$id");
?>
Then when i would do: "http://localhost/test.php?id=1" it comes up blank. Now if i do this on my actual WEBserver it works fine.
Anyone have any idea why this would not work? It worked fine with previous versions of XAMPP i belive!
Thanks alot for any help.
-Jon
since you are passing it via the URL, you can use the the super global variable array $_GET
so in this case:
- Code: Select all
echo ($_GET["id"]);
note that no "$" is needed inside the brackets since, the $_GET is an array...
- Code: Select all
http://localhost/test.php?id=1&id2=2
would be accessed like:
- Code: Select all
echo ($_GET["id"]);
echo ($_GET["id2"]);
if you are processing a FORM with an POST, you just use the $_POST super global instead...
personally, whenever i need to access any super global variable, i like to assign them local (in scope-wise) variable for easier access...
leo d.