jaylearning Posted December 13, 2007 Share Posted December 13, 2007 Hi! thanks for looking. i cant seem to work out how to get my drop down menu to select the value that has been selected when submiting. please help me im so new to this i cant work it out i looked at so many tutorials. <select name="autoplay"><? if ($myrow["autoplay"] == "1") { echo '<option value="0">No</option> <option value="1" selected="selected">Yes</option>'; } else { echo '<option value="0" selected="selected">No</option> <option value="1">Yes</option>'; } ?> </select> Link to comment https://forums.phpfreaks.com/topic/81497-php-mysql-edit-help-for-dropdown-select/ Share on other sites More sharing options...
marcus Posted December 13, 2007 Share Posted December 13, 2007 $sel = ($myrow['autoplay'] == '1') ? " SELECTED" : ""; echo "<select name=\"autoplay\">\n"; echo "<option value=\"0\">No</option>\n"; echo "<option value=\"1\"".$sel.">Yes</option>\n"; echo "</select>\n"; Link to comment https://forums.phpfreaks.com/topic/81497-php-mysql-edit-help-for-dropdown-select/#findComment-413757 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.