Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.