3
Contributors
3
Replies
18
Views
8 Years
Discussion Span
Last Post by phper
0

Store it in a session if you need to keep it for an indefinite amount of time. If you need the user to re-enter some information but keep this value the same, add

selected="selected"

inside the <option> tag.

0

You could use something like:

<form method="post" action="page.php">
   <select name="people" id="people">
    <?php if($_POST['submitted'] == true){ ?>
        <option value="<?php echo $_POST['people']; ?>" selected="selected"><?php echo $_POST['people']; ?></option>
    <?php }else{ ?>
      <option value=""> -- select -- </option>
    <?php } ?>
       <option value="" disabled="disabled"> -------- </option>
       <option value="Person 1">Person 1</option>
       <option value="Person 2">Person 2</option>
   </select>
   <input type="submit" id="submit" name="submit" value="Submit" />
   <input type="hidden" name="submitted" id="submitted" value="true" />
</form>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.