If - elseif Statement
Posted: Sat Mar 17, 2007 10:20 pm
Does anybody see anything wrong with these statements?
For some reason the select box is returning a blank box and of course I get the echoed value 'BLAH' I know the value of $ampm is being passed, I've even echoed it out to check. So that means theres something wrong with my if statements I just can't figure it out.
Code: Select all
if($ampm == 'PM'){
$display .= '<option value="'. $ampm .'" selected>'. $ampm .'</option>';
$display .= 'option value="AM">AM</option>';
} elseif ($ampm == 'AM') {
$display .= '<option value="'. $ampm .'" selected>'. $ampm .'</option>';
$display .= '<option value="PM">PM</option>';
} else {
echo 'BLAH';
}