Hello I am trying a code from a book, When I run it at local host and enter a number on the box I get this error :
Have requested is not allowed to access the directory. Directory, or to read protected, or can not be read by the server.
If you think this is a server error, please contact the site administrator.
localhost
04.03.2011 11:43:22
Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1
And this is the coed I am trying :
<?php
$num_to_guess = 42;
if (!isset($_POST['guess'])) {
$message = "Welcome to the guessing machine!";
} else if ($_POST['guess'] > $num_to_guess) {
$message = "$_POST[guess] is too big! Try a smaller number.";
} else if ($_POST[guess] < $num_to_guess) {
$message = "$_POST[guess] is too small! Try a larger number.";
} else { // must be equivalent
$message = "Well done!";
}
?>
<html>
<head>
<title> A PHP number guessing script</title>
</head>
<body>
<h1><?php echo $message; ?></h1>
<form action="<?php echo $_SERVER[PHP_SELF]; ?>" method="POST">
<p><strong>Type your guess here:</strong> <input type="text" name="guess"></p>
<p><input type="submit" value="submit your guess"></p>
</form>
</body>
</html>
Can you tell me why I am getting an error. Thanks