Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //index.php
- $correct_answer = 'Mark';
- if($_SERVER['REQUEST_METHOD'] == 'POST') {
- if(!isset($_POST['dad') || $_POST['dad'] !== $correct_answer)
- {
- $error = '<p>You answered your father\'s name wrong. Please try again.';
- }
- else
- {
- header("Location:q2.php");
- }
- }
- if(!empty($error))
- echo $error;
- ?>
- <form action="index.php" method="post">
- <label>Enter your father's name:</label>
- <input autofocus required autocomplete="off" type="text" name="dad" placeholder="Bill">
- <input type="submit" value="Press me when you think you are right" />
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement