I'm working through a book called "PHP/MySQL 5" from the absolute
beginners series. I am stuck on one of the little "challenges" at
the end of the "Loops and Arrays" chapter. The challenge is to write
a "Thinking of a Number" game where the computer thinks of a number
and the user tries to guess it. The game should tell the user "high,
low, or correct". When the correct answer is found, the game is
supposed to print the number of tries it took to get the correct
answer. The challenge says that arrays are not needed for this
excersise. I was hoping someone out there might tell me where I'm
going wrong.
"<html>
<head>
<body>
<form>
<?
$number = rand (1,20);
print <<<HERE
<center>
<input type ="text"
name = "guess"
value = "$guess">
<input type ="hidden"
name ="number"
value ="$number">
<input type ="hidden"
name ="guessCounter"
value ="$guessCounter">
<input type ="submit"
value ="guess">
</center>
HERE;
if ($guess > $number){
print "High";
guessCounter++;}
else if ($guess < $number){
print "Low";
$guessCounter++;}
else {
print "Correct";
$guessCounter;}
?>
</form>
</body>
</html>
If anyone could help, it would be appericated.
Thanks in advance,
Jeff
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/HKFolB/TM
--------------------------------------------------------------------~->
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/