Advertisement
Guest User

All Experts Answer

a guest
Feb 21st, 2013
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1. <?php
  2. //index.php
  3.  
  4. $correct_answer = 'Mark';
  5.  
  6. if($_SERVER['REQUEST_METHOD'] == 'POST') {
  7.   if(!isset($_POST['dad') || $_POST['dad'] !== $correct_answer)
  8.   {
  9.     $error = '<p>You answered your father\'s name wrong. Please try again.';
  10.   }
  11.   else
  12.   {
  13.     header("Location:q2.php");
  14.   }
  15. }
  16.  
  17. if(!empty($error))
  18.   echo $error;
  19. ?>
  20.  
  21. <form action="index.php" method="post">
  22.     <label>Enter your father's name:</label>
  23.     <input autofocus required autocomplete="off" type="text" name="dad" placeholder="Bill">
  24.     <input type="submit" value="Press me when you think you are right" />
  25. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement