Quote Originally Posted by annie View Post
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>
This script have bugs.

bug 1

Code:
echo '<h1 style ="color:Blue"> Your number is too Small >/h1>';
>/h1> instead of </h1>

bug 2

Code:
echo '<h1 style ="color:Red"> Your number is too BIG <h1>';
<h1> instead of </h1>