I suppose that you are using an array to create your select
form input.
In that case, use an array:
'selected="selected"' );
$fields = array(1 => 'Yes', 2 => 'No', 3 => 'Fine');
?>
If not, you may just unroll the above loop, and still use an array.
Notes that I don't know:
- how you are naming your input, so I made up a name for it.
- which way you are handling your form input on server side, I used
$_REQUEST
,
You will have to adapt the code to match requirements of the framework you are using, if any.
Also, it is customary in many frameworks to use the alternative syntax in view dedicated scripts.