Populating a Select dropdown with data stored in the database can be tricky if not done correctly. This is the best way to recall that data simply.
1 2 3 4 5 6 7 8 9 10 11 |
//get info from DB $options = $row['options']; <select name="course"> <option value="0">Please Select Option</option> <option value="PHP" <?php if($options=="PHP") echo 'selected="selected"'; ?> >PHP</option> <option value="ASP" <?php if($options=="ASP") echo 'selected="selected"'; ?> >ASP</option> </select> |