You don't have permission to access
Posted: Tue Oct 24, 2006 4:57 pm
feyd | Please use
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi All,
First some preliminaries. I'm new to this forum. I'm also WAMP newbie. Please help me solve the problem described below?
I have installed Apache 2 & PHP 5 on Windows XP Pro Sp2. After I submit the form (the code fragment shown below which I copied from a book) I get the error message "[color=red]You don't have permission to access /< on this server[/color]".
When I checked the error log under Apache logs directory this is the error message in error.log file:
"[color=red]The given path misformatted or contained invalid characters: Cannot map POST /%3C?=$_SERVER['PHP_SELF']?%3E HTTP/1.1 to file, referer: http://localhost/db2insert01.php[/color]"
Code Fragment:Code: Select all
<html>
<head>
<basefont face="Arial">
</head>
<body>
<?php
if (!$_POST['submit'])
{
// form not submitted
?>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
Item name: <input type="text" name="name">
Item price: <input type="text" name="price">
<input type="submit" name="submit">
</form>
<?php
}
else
{
// get form input
// escape input values for greater safety
$name = (trim($_POST['name']) == '') ? die ('ERROR: Enter a name') : mysql_escape_string($_POST['name']);
$price = (trim($_POST['price'] == '') || !is_numeric($_POST['price'])) ? die ('ERROR: Enter a price') : $_POST['price'];
// open connection
// more code left out that is never reached
...
...
}
?>
</body>
</html>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]