stockton Posted August 23, 2007 Share Posted August 23, 2007 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. Quote Link to comment Share on other sites More sharing options...
Jessica Posted August 23, 2007 Share Posted August 23, 2007 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. Quote Link to comment Share on other sites More sharing options...
stockton Posted August 23, 2007 Author Share Posted August 23, 2007 Thanks but I have still to understand code tags? Quote Link to comment Share on other sites More sharing options...
Jessica Posted August 23, 2007 Share Posted August 23, 2007 In the editor. Hit the button next to the quote button. It looks like a #. Or type [.code]code here[/.code] without the . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.