Jump to content


Photo

How to remember List/Menu value?


  • Please log in to reply
2 replies to this topic

#1 herando

herando
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 13 June 2006 - 10:15 AM

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>

#2 joquius

joquius
  • Members
  • PipPipPip
  • Advanced Member
  • 319 posts

Posted 13 June 2006 - 10:17 AM

on each option add this

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

#3 herando

herando
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 13 June 2006 - 11:51 AM

thanx :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users