Re: Random number Question

From: Date: Mon, 29 Apr 2002 15:51:05 +0000
Subject: Re: Random number Question
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-95186@lists.php.net to get a copy of this message
OOPS! You are right on.. I noticed my error after I sent it. The name='guess' was on the input.?? Daaa! it's Monday .. OK!! This should work: =================================================== <? $another = 'a'; if (isset($guess)) $another = 'another'; echo " <form action='number.php' method='post'> <BR> The computer has picked $another number between 1 and 10.<BR> Guess the number and you win!<BR> <BR> Enter your guess: <input type='text' size='3' NAME='guess'> <INPUT TYPE='submit' VALUE='Submit my number'> </form>"; if (isset($guess)) { srand((double)microtime()*1000000); $number = floor(rand(1,10)); echo "The number is: $number<BR>"; if ($guess == $number)
     	echo '<BR>You have won!';
else echo "<BR>Sorry that wasn't the answer"; } ?>

« previous php.general (#95186) next »