> [EMAIL PROTECTED] wrote" "On 2/17/2008 5:36 PM":"
>>
>>
>> ----- 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.
> 
> <?=$whatever?> is perfectly acceptable when doing echo's inside of html. 
> The problem here seems to be the fact that apache does not have 
> permission to access the directory. The linux solution would be chown or 
> chmod to give the html directory permission to be used by apache, I'm 
> not sure how to do it in Windoze.
> 
> 
> Billy P.
> 
Sorry, I just saw your logfile & the permissions certainly doesn't look 
like the problem.

<?=$whatever?> should be acceptable.
Perhaps, the problem is with the single quotes inside the doubles.
Try the following:
<form action="<?={$_SERVER['PHP_SELF']}?>" method="POST">

Or for that matter, just do:
<form action="" method="POST">
That will post to the current page...

Billy P.


Reply via email to