You don't have permission to access...
Posted by:
Subcontinental
(---.dhcp.spbg.sc.charter.com)
I've just installed WAMP and I've been doing some tutorials as I'm trying to learn PHP and MySQL, but I've run across a problem. Here is my code:
Quote
<html>
<head></head>
<body>
<?php
//check if form has been submitted
if (!$_POST['submit'])
{
//if not, display form
?>
Select from the items below: <br />
<form action="<?=$_SERVER['PHP_SELF']?>" method="POST">
<select name="options[]" multiple>
<option value="power steering">Power steering</option>
<option value="rear wiper">Rear windshield wiper</option>
<option value="cd changer">6 CD Changer</option>
<option value="fog lamps">Fog lamps</option>
<option value="central locking">Central locking</option>
<option value="onboard navigation">Computer-based navigation</option>
</select>
<input type="submit" name="submit" value="Select">
</form>
<?php
}
else
{
// form has been submitted
//check if any items were selected
//if so, display them
if (is_array($_POST['options']))
{
echo 'Here is your selection: <br />';
// use a foreach() loop to read and display array elements
foreach($_POST['options'] as $o)
{
echo "<i>$o</i><br />";
}
}
else
{
echo 'Nothing selected';
}
}
?>
</body>
</html>
The page that has the form works fine, but whenever I try to submit I get a message saying
Quote
Forbidden
You don't have permission to access /php_tutorials/< on this server.
What exactly is wrong with what I'm trying to do? I notice that everytime I use <?=$_Server['PHP_SELF']?> I get an error message after trying to submit. Thanks.
Edited 1 time(s). Last edit at 03/05/2008 04:24AM by Subcontinental.