I have a menu with 3 options, that in the simplest form looks like:
<form action="samePageAction" form="post">
<select>
<option>Yes</option>
<option>No</option>
<option>Maybe</option>
</select>
</form>
It isn't really "dynamic", its just based on a user's setting in the database, I'm choosing what "option" to display by default:
<form action="samePageAction" form="post">
<select>
<?
if(!$personUndecided && $personHasAgreed){
?>
<option>Yes</option>
<option>No</option>
<option>Maybe</option>
<?
} else if(!$personUndecided && !$personHasAgreed){
?>
<option>No</option>
<option>Yes</option>
<option>Maybe</option>
</select>
<?
else {
?>
<option>Maybe</option>
<option>Yes</option>
<option>No</option>
</select>
<? } ?>
</form>
The "first" option in each case is important, because when the form is disabled, that is the option the user will see. I feel gross when I look at this, but a better solution isn't coming to me. How can I optimize this menu?
Question: How can I prevent repeating myself this much. Or does this code look perfectly normal?
elsestatement will never be executed