How to remember List/Menu value?

Discussion in 'PHP' started by herando, Jun 13, 2006.

  1. #1
    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>
     
    herando, Jun 13, 2006 IP
  2. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <option value="0" <?php if($rows['object']=="0"){ echo"selected"; } ?>>Beer</option>
    PHP:
     
    mad4, Jun 13, 2006 IP