Jump to content

Retain select menu value when error occurs


Eiolon

Recommended Posts

I am able to retain the value a user has entered into a text box in the event of an error.  How would I do this with a select menu?

 

Here is my select menu:

 

<select name="department_id" id="department_id" style="width:406px;"><option>SELECT</option>
<?php while($row_departments = mysql_fetch_array($departments)) { print '<option value="' . $row_departments['id'] . '">' . $row_departments['name'] . '</option>';}?>
</select>

 

I am not sure where to echo the selection at.

 

<?php if (isset($_POST[department_id])) echo $_POST[department_id]; ?>

 

Archived

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

×
×
  • Create New...

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.