View Single Post
Old 04-29-2011, 08:51 AM  
eMonk
Confirmed User
 
Industry Role:
Join Date: Aug 2003
Location: Canada
Posts: 2,310
PHP/MYSQL: form <select> question

How can you fetch data into select form fields and have the data stored in the database as selected?

Code:
<select name="favourite_fruit">
<option>Apples</option>
<option>Bananas</option>
<option>Oranges</option>
</select>
I was thinking something like:

Code:
<select name="favourite_fruit">
<option selected><?= $fruit ?></option>
<option>Bananas</option>
<option>Oranges</option>
</select>
But don't think the unselected fruits would show up in the select menu...
eMonk is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote