Php form not passing on all values

Discussion in 'PHP' started by Darden12, Apr 6, 2010.

  1. #1
    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'");
     
    Last edited: Apr 6, 2010
    Darden12, Apr 6, 2010 IP
  2. stephan2307

    stephan2307 Well-Known Member

    Messages:
    1,277
    Likes Received:
    33
    Best Answers:
    7
    Trophy Points:
    150
    #2
    shouldn't it be
    
    $_POST
    
    PHP:
    instead of
    
    $_post
    
    PHP:
    ? I could be wrong but I am sure that makes some kind of difference
     
    stephan2307, Apr 6, 2010 IP
  3. Darden12

    Darden12 Well-Known Member

    Messages:
    107
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #3
    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
     
    Darden12, Apr 6, 2010 IP
  4. nabil_kadimi

    nabil_kadimi Well-Known Member

    Messages:
    1,065
    Likes Received:
    69
    Best Answers:
    0
    Trophy Points:
    195
    #4
    OMG, are you working with REGISTER_GLOBALS on?
     
    nabil_kadimi, Apr 6, 2010 IP
  5. Darden12

    Darden12 Well-Known Member

    Messages:
    107
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #5
    I have a shared hosting set up, but when I run phpinfo, I see "ON' for register_globals and auto_globals.
     
    Darden12, Apr 6, 2010 IP
  6. nabil_kadimi

    nabil_kadimi Well-Known Member

    Messages:
    1,065
    Likes Received:
    69
    Best Answers:
    0
    Trophy Points:
    195
    #6
    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..)
     
    nabil_kadimi, Apr 6, 2010 IP
  7. Darden12

    Darden12 Well-Known Member

    Messages:
    107
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #7
    Thanks for the heads-up! I'll definitely look into it.
     
    Darden12, Apr 6, 2010 IP
  8. Cloud Computing Forum

    Cloud Computing Forum Guest

    Messages:
    55
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Superglobal arrays al use capitals e.g. $_SERVER, $_GET, $_POST, $_ENV, glad you worked out your problem.
     
    Cloud Computing Forum, Apr 7, 2010 IP