Outputting the else no matter if it's met or not --


#1

Would love any ideas about what is wrong with my code - I thought it would output "you are ok" because i set the name to Stephen...but it still outputted the echo for Tom. Any ideas?







<?php
$name = "stephen";
if ($name = "tom") {
echo "you are cool";
}
elseif ($name = "stephen") {
echo "you are ok";
}
else {
echo "not your lucky day";
}
?>


#2

I don't know php but I assume the = sign is for assignments, and not for comparisons.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.