0

Hello there im new to php and for some reason im having trouble with the String variables, every time i change the $light variable it doesn't = the supposed String and just always echo's "stop".

<html> <head> <title> Conditional Statement Practice </title> </head>
<body>
<?php 
 extract($_GET);

 /* Put your PHP code in here */
 $light="orange";
 
 if($light="red"):
 	echo "stop";
 elseif($light="orange"):
 	echo "prepare to stop";
 elseif($light="green"):
 	echo"proceed";
 endif;

?>
</body>
</html>
2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by diafol
0

Oh i feel silly ==

<html> <head> <title> Conditional Statement Practice </title> </head>
<body>
<?php 
 extract($_GET);

 /* Put your PHP code in here */
 $light="green";
 
 if($light=='red'):
 	echo "stop";
 elseif($light=='orange'):
 	echo "prepare to stop";
 elseif($light=='green'):
 	echo"proceed";
 endif;

?>
</body>
</html>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.