Showing current value in DB in a drop down box
- by user195257
Hello,
this is my code which populates a drop down menu, all working perfectly, but when editing a database record, i want the first value in the drop down to be what is currently in the database, how would i do this?
<li class="odd"><label class="field-title">Background <em>*</em>:</label> <label><select class="txtbox-middle" name="background" />
<?php
$bgResult = mysql_query("SELECT * FROM `backgrounds`");
while($bgRow = mysql_fetch_array($bgResult)){
echo '<option value="'.$bgRow['name'].'">'.$bgRow['name'].'</option>';
}
?>
</select></li>