Re: [PHP] Random number Question
$guess = = $number is wrong. You should write: $guess == $number Regards, Hiroshi Ayukawa http://hoover.ktplan.ne.jp/kaihatsu/php_en/index.php?type=top -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Random number Question
Hi all, I having a hard time understanding why this won't work. I have a form which is suppose to pass the guess to the script. Here it is: the form is guess.php: form action=number.php method=post The computer has picked a number between 1 and 10. Guess the number and you win!BR Enter your guess: input type=text size=3 INPUT TYPE=submit VALUE=Submit my number NAME=guess /form The script is number.php: ?php echoThe number is:; srand((double)microtime()*100); $number = rand(1,10); echo $number; if($guess = = $number) { echoBRYou have won!; }else{ print(BRSorry that wasn't the answer); } ? Any help would be appreciated. Thanks in advance Jennifer Downey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Random number Question
Try Now: form action=number.php method=post The computer has picked a number between 1 and 10. Guess the number and you win!BR Enter your guess: input type=text name=guess value= size=3 INPUT TYPE=submit VALUE=Submit my number NAME=submit /form -Original Message- From: Jennifer Downey [mailto:[EMAIL PROTECTED]] Sent: Saturday, March 13, 2010 9:25 AM To: [EMAIL PROTECTED] Subject: [PHP] Random number Question Hi all, I having a hard time understanding why this won't work. I have a form which is suppose to pass the guess to the script. Here it is: the form is guess.php: form action=number.php method=post The computer has picked a number between 1 and 10. Guess the number and you win!BR Enter your guess: input type=text size=3 INPUT TYPE=submit VALUE=Submit my number NAME=guess /form The script is number.php: ?php echoThe number is:; srand((double)microtime()*100); $number = rand(1,10); echo $number; if($guess = = $number) { echoBRYou have won!; }else{ print(BRSorry that wasn't the answer); } ? Any help would be appreciated. Thanks in advance Jennifer Downey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php **Disclaimer Information contained in this E-MAIL being proprietary to Wipro Limited is 'privileged' and 'confidential' and intended for use only by the individual or entity to which it is addressed. You are notified that any use, copying or dissemination of the information contained in the E-MAIL in any manner whatsoever is strictly prohibited. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Random number Question
On Saturday 13 March 2010 11:54, Jennifer Downey wrote: Hi all, I having a hard time understanding why this won't work. I have a form which is suppose to pass the guess to the script. Here it is: It's no good just telling us it doesn't work. You need to tell us what happens when you run it. Error messages? Blank screen? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* 355/113 -- Not the famous irrational number PI, but an incredible simulation! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php