Hi Gary,
In a select box, you can determine the default selected option by putting "selected" in the option tag. If there aren't any selected directives in the options tags, the first option will be displayed.
So, the thing to do is not to create your select box statically. Create it using an array.
Then as you create the select box, check to see if the card selected is equal to the option value being echoed. If it is, put the word 'selected' into the option tag.
If $credit is undefined $sel will always be equal to '' and the first option will be displayed.
$cc[]='discover';
$cc[]='visa';
$cc[]='amex';
echo "<select name=credit>";
for($i=0; $i < sizeof($cc); $i++)
{
$sel=($cc[$i] == $credit) ? ' selected' : '';
echo "<option$sel value=$cc[$i]>$cc[$i];
}
matt.