| Control Structures: elseif | |
| <html> <head> <title>elseif example</title> </head> <body> <form action="elseif.php" method="POST"> <input name="name" type="text"><br><input type=submit value="Please Submit"> </form> </body> </html> |
<?php $test= $_POST[name]; echo "Hi.$_POST[name].<br>"; if ($test==""){ echo "oops! did not enter your name <br>"; } elseif (($test=="admin") || ($test=="Baba")) { print("Hello $test");} else { echo "sorry did not pass"; } echo "<br>welcome"; ?> |
![]() |
![]() |
![]() |
![]() |