True, that definitely will work, but my example expects the states to be inarray, with a corresponding user value for their state. Say, for instance, you have an array call $states, -- $states[0] = "AL", $states[1] = "AK", etc.... and a varialbe called $user_state whihc is the state the user is in, then you could change your code to this:
echo "<select name=\"state\">";
while(list(,$st) = @each($states)) {
$sel = ($user_state == $st ? "SELECTED" : "");
echo "<option $sel value=\"$st\">$st";
}
echo "</select>";