Moderators note: Please don't post long footers and post your new text  below 
the original text.

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL 
PROTECTED]
Sent: Monday 18 February 2008 00:36
To: [email protected]
Subject: Re: [php-list] You don`t have permission to access /< on this server



----- 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. .

 
<http://geo.yahoo.com/serv?s=97359714/grpId=303031/grpspId=1705005703/msgId=21923/stime=1203287788/nc1=3848640/nc2=5191954/nc3=4763762>



Discovery Holdings Limited

<footer removed by moderator>

---------------------------------
Hi Everyone and Rob,



Thanks for everyone's response to my question.



The following is an extract from the actual e-book I'm using to train:

"How to Do Everything with PHP and MySQL - McGraw Hill"



"Taking a Shortcut

The <?=$variable?> syntax is a shortcut for quickly displaying the value of

a variable in a PHP script. It is equivalent to <?php echo $variable; ?>."



But I will surly try the all recommendations that everyone in the group has 
send through.



Thanks, Arné

Reply via email to