Page 1 of 1

help with some code

PostPosted: 31. August 2009 16:35
by Zero10
Hello,

I'm using XAMPP v1.7.2 on a Windows Vista x64 system.
When I enter the following code out of a book I'm using to learn PHP (McGraw.Hill.PHP.Programming.Solutions(Jun.2007))
I get the error msg stated at the bottom of this message. Can anyone tell me what I need to set or do to make this code work properly?

Code: Select all

<html>
<head></head>
<body>
<?php
if (!$_POST['submit']) {
// if $_POST['submit'] does not exist
// display initial page
?>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
Enter your age: <input name="age" size="2" maxlength="2">
<input type="submit" name="submit" value="Go">
</form>
<?php
} else {
// if $_POST['submit'] exists
// process form data
$age = $_POST['age'];
echo ($age >= 21) ? "You're an adult" : "You're a child";
}
?>
</body>
</html>



I get the following Error Message:

Access forbidden!
You don't have permission to access the requested object. It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster.

Error 403

Re: help with some code

PostPosted: 31. August 2009 17:03
by Wiedmann
I get the following Error Message:

What are you doing exactly while you're getting this message?

Re: help with some code

PostPosted: 31. August 2009 18:21
by Zero10
I'm just running it on my testing server (XAMPP).

Re: help with some code

PostPosted: 31. August 2009 18:25
by Wiedmann
I'm just running it on my testing server (XAMPP).

You mean you access this file with your browser with a mystic URI, and know you can see this error message in your browser?