Jump to content

[SOLVED] Getting table selection


stockton

Recommended Posts

Please tell me what I have done wrong in the following code.

 

    $SQL = "SELECT EventID, EventName, LastDrawDate FROM Event WHERE '$Datum'>=StartDate AND '$Datum'<=LastDrawDate";

 

    $rs = mssql_query($SQL, $link);

    echo '<td><select name="Event">';

    while ($row = mssql_fetch_array($rs))

 

        {

 

        $Number = $row['EventID'];

 

        $Message = sprintf("%25.25s", $row['EventName']);

 

        $LastDrawDate = $row['LastDrawDate'];

 

        echo "<option value=".$Number.">$Message</option>";

 

        ++$Count;

 

        }

    echo '</select></td>';

 

    echo "<a href=TI3-2.php?Event=$Number><img src=images/Submit.png></a>";

 

The table works perfectly but the $Number in the last line retains the same value no matter what was selected in the table.

 

Link to comment
https://forums.phpfreaks.com/topic/66367-solved-getting-table-selection/
Share on other sites

Use code tags please!

 

$number in the last line will be the last value $number in the loop. If you want it to change dynamically when the user changes the drop down menu, you need to use javascript. PHP is done before the page loads. Do some googleing on "client-side" and "server-side" and you'll see the difference.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.