Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $num1 = Rand(0,10);
- $num2 = Rand(0,10);
- if(is_int($_POST['userInput']) == 1) {
- if($num1 * $num2 == $_POST['userInput']) {
- header("Location: correct.html");
- exit();
- } else {
- echo "WRONG!";
- }
- }
- //Produce two variables with random integer between 1 and 10.
- ?>
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Simple Math Quiz</title>
- </head>
- <body>
- <h1><?php echo "What is " . $num1 . " times " . $num2 . "?"?></h1>
- <?php
- ?>
- <form name="form" method="POST" action="<?php echo $_SERVER['PHP_SELF'];?>">
- <input type="text" name="userInput"/>
- <br/>
- <br/>
- <button type="submit" name="submit" value="send">Submit</button>
- <input type="hidden" name="answer" value="<?php echo $answer; ?>" />
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement