Page 1 of 1

If - elseif Statement

Posted: Sat Mar 17, 2007 10:20 pm
by aspekt9
Does anybody see anything wrong with these statements?

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';
		}
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.

Posted: Sat Mar 17, 2007 10:25 pm
by John Cartwright

Code: Select all

$display .= 'option value="AM">AM</option>';
Your missing a <

Aside from that I don't see anything else wrong.

What does

Code: Select all

var_dump($ampm);
yield?