Problems with guess a number game
<p>Hey, I am so close to fininshing my guess a number game, very simple in PHP, but for some reason I am stuck. I am storing the variable in a hidden form, but obviously each time the page is sent it resets the number so you can never get the right one.</p>

<p>Any ideas? My code is below.</p>

<pre><code>&lt;?php
// generate a random number for user to guess
$number = rand(1,100);

if($_POST["guess"]){

    // grab the user input guess
    $guess  = $_POST['guess'];
    $numbe  = $_POST['number'];
    if ($guess &lt; $number){ 
     echo "Guess Higher";
    }elseif($guess &gt; $number){       
     echo "Guess Lower";
    }elseif($guess == $number){      
     echo "You got it!";
    }
    echo "&lt;br /&gt;Random Number:".$number."&lt;br /&gt;";
    echo $guess;
}
?&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
&lt;title&gt;Guess A Number&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;form action="&lt;?=$_SERVER['PHP_SELF'] ?&gt;" method="post" name="guess-a-number"&gt;
    &lt;label for="guess"&gt;Guess A Number:&lt;/label&gt;&lt;br/ &gt;
    &lt;input type="text" name="guess" /&gt;
    &lt;input name="number" type="hidden" value="&lt;?= $number ?&gt;" /&gt;
    &lt;input name="submit" type="submit" /&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
