I have a combo box and want to populate it with the selected value upon page reload. For a normal text field I would usually do something like this:

<input type="text" name="title" value="<?php echo $_SESSION['sellform']['title']; ?>">

How could I do the same for a drop-down box? E.g:

<select name="condition">						
					<option value="">--Condition--</option>
					<option value="new">New</option>
					<option value="used">Used</option>

if the items are stored in dbase you could use while
something like

echo "<option> $value </option>";

What if the data is hardcoded? Basically the user specifies their product details, then clicks submit, the form data is then posted back to itself on the same page to be validated (server-side). If errors are detected, then I want the fields to be re-populated with the users session data... Simples?

My attempt:

<td><select name="condition" <?php echo htmlentities($values['condition']) ?>>						
	<option value="">--Condition--</option>
	<option value="new">New</option>
         <option value="used">Used</option>
        <option value=""><?php echo $_SESSION['sellform']['condition']?></option>

I've got it working for all input fields except for drop-down boxes.

Thanks in advance

if your posting back to yourself you i would suggest putting it all in a form


if (isset($_POST['submit'])){
$product = $_POST['product'];
if ($product ==""){
echo "something missing";
<form method="post" action=<?php $_SERVER[PHP_SELF];?>
form stuff and all your options etc