Alright alright, so I'm trying to work with switch. I want to output a particular statement based on the first/last name inputted. Currently, any "Lucas" first name (with any last name) will output the desired output for only a "Lucas Cul". It's also giving me this error when I try to add the else statement:
Parse error: syntax error, unexpected T_ELSE in
switch($fname) {
case "Daniel":
if ($lname = "Mosq") {
echo "Welcome, righteous Supervisor!";
}
break;
case "Lucas":
if ($lname = "Cul") {
echo "Welcome, leader of the apes!";
else {
echo "You are not the Lucas we are looking for. Access denied.";
}
}
break;
default:
echo "Your name is not recognized, however we will give you temporary access.";
}
Thanks for the advice,
Cheers


Sign In
Create Account


Back to top










