If - elseif Statement

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
aspekt9
Forum Commoner
Posts: 43
Joined: Wed Dec 06, 2006 5:03 pm

If - elseif Statement

Post 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.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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?
Post Reply