/* we'll assume that you have all of your options in an array called $options, and that the value of the option you want selected is in $optionselected. There are, of course, other ways to do this.*/foreach($options as $option) { echo "\t<option value=\"", $option, "\"", ($option == $optionselected ? ' selected : ''), ">\n";}

echo '</select>', "\n";

You can, of course, do this without the loop, but your code looks a little crufty if you do: