I'm trying to decipher: when I select the record to edit the drop-downlist has the first option as the value instead of what the corresponding StateID in the column reads. How can I correct this? The form to insert and edit have the below code and correctly insert the StateID
What exactly is happening? Run the script, do a View Source on the resulting page; show us the HTML generated. -----Original Message----- From: Steve Fitzgerald [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 26, 2002 5:22 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Selecting Drop Down Value From DB to Edit I have the below code that populates a drop down list. The code will correctly insert the value $StateID into another a table. The problem I am running into is that when I select the record to edit the drop-downlist has the first option as the value instead of what the corresponding StateID in the column reads. How can I correct this? The form to insert and edit have the below code and correctly insert the StateID. I tried to write and if statement to state that if the StateID were == to the StateID in he table then print selected, but I think I am missing something. Any suggestions? Thanks. <?php // populates state drop-down list $get_stateid_query = mysql_query("SELECT * FROM State INNER JOIN RaceResults ON State.StateID WHERE RaceID='$RaceID'"); echo " <select name=\"StateID\">\n"; while ($myrow = mysql_fetch_array($get_stateid_query)) { echo ' <option value="'.$myrow["StateID"].'">'.$myrow["StateName"]."</option>\n"; } echo " </select>\n"; ?> -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php