/ Published in: PHP

Simple PHP tutorial on how to use isset.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <title>PHP Test</title> </head> <body> <?php ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> Enter your age: <input name="age" size="2"> <input type="submit" name="submit" value="Go"> <?php } else { //Grab the text we input $input = $_POST['age']; if($input < 27){ echo "You are young"; } elseif($input == 27){ echo "The perfect age"; } elseif($input > 27){ echo "You are old!"; } } ?> </body> </html>
URL: http://devzone.zend.com/node/view/id/628
Comments
