http://php.flashwebhost.com/annie/9day_number_game.php
Code:<html> <body> <h1>Guess the Secret Number - Numbers up to 1 to 20 </h1> <?php if (isset($_POST['secretNumber'])) { $secretNumber = $_POST['secretNumber']; } else { $secretNumber = rand(1,20); } if (isset($_POST['userNumber'])) { $userNumber = $_POST['userNumber']; if ($secretNumber > $userNumber) { echo '<h1 style ="color:Blue"> Your number is too Small >/h1>'; } else if ($secretNumber < $userNumber) { echo '<h1 style ="color:Red"> Your number is too BIG <h1>'; } else { echo '<h1 style="color:green">You win the game.</h1>'; } } ?> <form method = "POST" action=""> Enter Number: <input name="userNumber" type="text"> <button type = "submit"> Check</button> <input type="hidden" name="secretNumber" value"<?php echo $secretNumber; ?>"> </form>




Reply With Quote
Bookmarks