Me again,
Following along with the tutorials I came to a party where I create a PHP number-guessing game that reloads itself.
The Game:
<?php
$number_to_guess = 42;
$message = "";
// This if statement tests whether the $_POST[guess] variable has been set,
// that is if it is present. Without this first clause, our tests would run
// before a guess has been made.
if (!isset($_POST[guess]))
$message = "Welcome to the Guessing Machine!";
else if ($_POST[guess] > $number_to_guess)
$message = "$_POST[guess] is too big! Try a smaller number.";
else if ($_POST[guess] < $number_to_guess)
$message = "$_POST[guess] is too small! Try a bigger number.";
else
$message = "You got it!";
?>
And the HTML/form,
<p>Message: <?php echo $message; ?></p>
<form action="<?php echo $_SERVER[PHP_SELF]; ?>" method="post">
Type Your Guess Here: <input type="text" name="guess" size="4"> <button name="" value="submit your guess" type="submit">Guess</button>
</form>
When I click the "Guess" button, I get a File Not Found error. Any ideas?