<html>
<head>
<body>
<center>
<!-- Wrong
<form method = "$_Post">
-->
<form method="post">
<?php
// When writing code, it is a lot easier to read if you indent
// depending on the logic level. I put the opening brace on its
// own line, but it is more common (old-fashioned?) to put it
// at the end of the preceeding line
// You need to declare variables before you use them as the source
// for other data or else you will get an error - you can suppress
// errors like this but it is not a good idea
// For example $guessCounter++ does not have a value to add 1 to
// if (empty($guesses))
//
// You seem to have two variables where there should be
// only one
// but it is still wrong as $guessCounter will always
// be empty - where would it get a value from? It does
// not actually exist at this point
// You need to save it in a hidden field same as
// you do with $number
if (empty($guessCounter))
{
$number = rand (1,50);
// $guesses++;
$guessCounter++;
}
// you can't just throw in HTML, you have to print it!
/*
<input type ="hidden"
name = "Number"
value = "$number">
*/
print "<input type='hidden' name='Number' value='$number'>";
if ($guess > $number)
{
print "High";
$guessCounter++;
}
elseif($guess < $number)
{
print "Low";
// you forgot the '$'
// guessCounter++;
$guessCounter++;
}
else
{
print "My number was $number and you got it in $guessCounter tries!
CONGRATZ!!!";
}
// you can't just throw in HTML, you have to print it!
/*
<input type ="text"
name = "guess"
value = "$guess">
<input type ="submit"
value = "Guess">
*/
print "<input type='text' name='guess' value='$guess'>";
print "<input type='submit' value='Guess'>";
// you don't close php with ?php>
?>
</center>
</body>
</html>
[Non-text portions of this message have been removed]
------------------------ 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/