What am I doing wrong?


#1

<!DOCTYPE html>
<html>
    <head>
		<title></title>
	</head>
	<body>
    <?php
    if($name= "Sam") {
        echo "Hi Sam!"
    } elseif ($name= "John") {
        echo "Hello John!"
    } else {
    echo "Where is Sam and John!?"
    }
    ?>
    </body>
</html>

#2

HI as comparator you should use == instead of =


#3

Changed those but it didn't make a difference... it is saying the { is unexpected on line 4...


#4

You should put a ; at the end of each echo statement

echo "Hi ...";

#5

I tested your code, this should work:







<?php
if($name= "Sam") {
echo "Hi Sam!";
} elseif ($name == "John") {
echo "Hello John!";
} else {
echo "Where is Sam and John!?";
}
?>


#6

If latest answer didn't help you, try introducing the name variable:
$name = "John";