Jump to content

Archived

This topic is now archived and is closed to further replies.

herando

How to remember List/Menu value?

Recommended Posts

Objective - to update table records via form field.

If I have text field, the field remembers the value in such way:

<input name="object" type="text" value=" <? echo $rows['object']; ?> "/>


How to remember the value of List/Menu field?

<select name="object">
<option selected="selected">--- choose ---</option>
<option value="0">Beer</option>
<option value="1">Wine</option>
<option value="2">Vodka</option>
</select>

Share this post


Link to post
Share on other sites
on each option add this

<? if ($_POST['object'] == $value) echo "selected=\"selected\""; ?> // $value being the value="num" of the option

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.