----- Original Message ----- 
From: "Arne Stone"

Hi guys,



I'm having some trouble while trying to learn PHP. Here is the code:



<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



When I click on the "Submit" button I get a page:



FORBIDDEN: You don't have permission to access /< on this server



Using MySQL, Apache, Windows XP.



Here are the errors that I'm receiving in my error.log file.



[error] [client 127.0.0.1] PHP Notice:  Undefined index:  submit in
C:\\Program Files\\Apache Software
Foundation\\Apache2.2\\htdocs\\test.php on line 6
[error] [client 127.0.0.1] (20024)The given path misformatted or
contained invalid characters: Cannot map POST
/%3C?=$_SERVER['PHP_SELF']?%3E HTTP/1.1 to file, referer:



I have read a lot on this on the internet but after applying all the
solutions out there I still receive these errors.....



Could someone please assist me?


Discovery Holdings Limited
----------------------------------------------
Hi,
   The normal opening tag for php is '<?php' or sometimes it is just '<?' I 
have never seen an opening tag of '<?='

In the code below you did not echo out the variable or terminate the php 
line with a ';' - this should be -

<form action="<?php echo($_SERVER['PHP_SELF']); ?>" method="POST">

Or even -

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">

Tanks, Rob. 

Reply via email to