I've passed variables through php forms for a year now, but this one doesn't work right. The strange thing is, it passes the variable called ThisID but it does not pass the other values. I've checked and checked for typos, but I can find none. Can anyone tell me why the following form only passes ThisID variable? <?php $result=mysql_query("SELECT * FROM Bloopers ORDER BY ID DESC") or die(mysql_error()); while ($row=mysql_fetch_array($result)) { $Blooper=$row['Blooper']; $ThisID=$row['ID']; $Comment=$row['Comment']; $URL=$row['URL']; $Setup=$row['Setup']; $CorrectVersion=$row['CorrectVersion']; ?> <form name="<?php echo $ThisID ?>" method="post" action="bloopers2.php"> <BR>Setup:<BR> <input type="text" name="Setup" value="<?php echo $Setup ?>"> <input type="hidden" name="ThisID" value="<?php echo $ThisID ?>"> <input type="submit" name="submit" value="submit"> </form> <HR><HR> <?php } ?> PHP: Here is the beginning of the code for the bloopers2.php, the target page of the form shown above -- again, only the ThisID variable is passed successfully to bloopers2.php when I execute the above script... $Blooper=$_post['Blooper']; $ThisID=$_post['ThisID']; $Comment=$_post['Comment']; $URL=$_post['URL']; $Setup=$_post['Setup']; $CorrectVersion=$_post['CorrectVersion']; PHP: I just did a var dump -- the variables DO show up in the var dump -- for example: the variable Setup shows up in var dump, but it does not get updated -- here's the update line, maybe something's wrong with it? $result=mysql_query("UPDATE Bloopers SET Setup='$Setup' WHERE ID='$ThisID'");
shouldn't it be $_POST PHP: instead of $_post PHP: ? I could be wrong but I am sure that makes some kind of difference
Thanks for the response: It worked after I put POST in all caps as you suggested. That surprises me because in my TextWrangler program, I can use lower-case and the color code still suggests that my code is correct that way. Thanks again. Brian
I have a shared hosting set up, but when I run phpinfo, I see "ON' for register_globals and auto_globals.
Well, you shouldn't be using it, it's deprecated (as of PHP 5.3) and won't be supported on PHP 6 You should set it to off using one of the methods available to you (php.ini, .htaccess, php function..)
Superglobal arrays al use capitals e.g. $_SERVER, $_GET, $_POST, $_ENV, glad you worked out your problem.