hello everybody, if anyone can help me with this, it would be much appreciated!!
Anywhoo, I am having issues with the superglobal array $_GET['whatevervariable'], in that I cant retrieve the variable.
Basically I am making my website for my class project, and have got most of it going. I am coding the administrative side to the site, and what I'm doing right now in perticular is viewing all the users in a query. I have that going, but I am sproocing it up, in that instead of all the users viewed in one long big page, but break it up into smaller pages so its just more managable. I am using the $GET superglobal array to accomplish this, but I am finding I can't get php to see any of the $GET variables.
So I decided, hey, forget this for a second, just make some example crappy forms using the get method and just throw some variables back and forth to see it happening. And low and behold I can't, I can't even make a little form submit using the $_GET array, because I can't see any of those variables there, even though I can PHYSICALLY see the variables in the submitted url, along with their respective variable names. So they are there, its just php isn't grabbing it. Anyways here is the code I'm working with.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title></title>
</head>
<body>
<?php
$quantity = $_GET["quantity"];
$item = $_GET["item"];
echo "Your a newb, here is why! $quantity, $item, see!?!?!?";
?>
<form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Item<input name="item" type="text" />
Quantity<input name="quantity" type="text" />
<input name="submit" type="submit" value="Submit" />
</body>
</html>
I have also tried the variable in these different formats as well:
$GET['quantity'];
$GET[quantity];
$REQUEST['quantity'];
$REQUEST["quantity"];
and still no luck, basically it just prints the message, "Your a newb, here is why! , see?!?!?!"
without any of the variables in there, meaning php is not seeing any of them.
I hope I have been detailed enough in explaining the issue, and if anyone needs more info, I'll be sure to answer it.
Thank you very much in advanced! 🆒
Edit - Here is the url I get when I used Item1 for item, and 400 for amounts
http://localhost/test_get.php?item=Item1&quantity=400&submit=Submit
So you can see, technically the get method worked, its just I can't see the variables. Also please don't tell me to turn register_globals on because
I'm trying to code the more 'secure' method and not use them.
P.S. - just to see if it would have worked I tried turning register_globals on and it still did not work, so that is not it. 🙂