Learning PHP and MySQL

Example 04-07 Checking multiple conditions

<?php
if  ($username  ==  "Admin"){
  
echo  ('Welcome  to  the  admin  page.');
}
elseif  ($username  ==  "Guest"){
  
echo  ('Please  take  a  look  around.');
}
else  {
  
echo  ("Welcome  back,  $username.");
}
?>

Posted by on 08/03 at 08:11 AM

Next entry: Example 04-08 Using the ? operator to create a message

Previous entry: Example 04-06 Else and if statements

<< Back to main