memberlogin
contactus
randomfacts

How to use the if elseif else statement in php

 The code below displays how to use the if elseif else statement in php.  This particular example is silly and checks to see if the preview variable holds the value Hello or Goodbye and displays an appropriate message to the screen in either case.

 

$preview = "Hello";

if ( $preview == "Hello") {

   echo "Hello World";

} elseif ($preview == "Goodbye") {

    echo "Goodbye World";

} else {

    echo "Where am I?";

}