Mysql
 sql >> Database >  >> RDS >> Mysql

Come mostrare un elenco a discesa con un'opzione preselezionata

Usa selected attributo.

<select name="status" id="status">
    <option value="open" <?php if($status=="open") { echo "selected"; } ?> >Open</option>
    <option value="done" <?php if($status=="done") { echo "selected"; } ?> >Done</option>
    <option value="pending" <?php if($status=="pending") { echo "selected"; } ?> >Pending</option>
    <option value="working" <?php if($status=="working") { echo "selected"; } ?> >Working</option>
</select>