The following cod,when I press the SUBMIT button , I get "Forbidden, You don't have permission to access /< on this server."

<title> The Internet Joke Database </title>
  if (isset($_GET['addjoke'])): // If the user wants to add a joke

<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<p>Type your joke here:<br />
<textarea name="joketext" rows="10" cols="40" wrap>
</textarea><br />
<input type="submit" name="submitjoke" value="SUBMIT" />
  else: // Default page display

    // Connect to the database server
    $dbcnx = @mysql_connect('localhost', 'root', 'mypasswd');
    if (!$dbcnx) {
      die( '<p>Unable to connect to the ' .
           'database server at this time.</p>' );

    // Select the jokes database
    if (! @mysql_select_db('jokes') ) {
      die( '<p>Unable to locate the joke ' .
           'database at this time.</p>' );

    // If a joke has been submitted,
    // add it to the database.
    if (isset($_POST['submitjoke'])) {
      $joketext = $_POST['joketext'];
      $sql = "INSERT INTO Jokes SET
      if (@mysql_query($sql)) {
        echo('<p>Your joke has been added.</p>'); 
      } else {
        echo('<p>Error adding submitted joke: ' .
             mysql_error() . '</p>');

    echo('<p> Here are all the jokes in our database: </p>');

    // Request the text of all the jokes
    $result = @mysql_query('SELECT JokeText FROM Jokes');
    if (!$result) {
      die('<p>Error performing query: ' .
          mysql_error() . '</p>');

    // Display the text of each joke in a paragraph
    while ( $row = mysql_fetch_array($result) ) {
      echo('<p>' . $row['JokeText'] . '</p>');

    // When clicked, this link will load this page
    // with the joke submission form displayed.
    echo('<p><a href="' . $_SERVER['PHP_SELF'] .
         '?addjoke=1">Add a Joke!</a></p>');




The funny thing is that 2 month ago,the same code , on the same machine worked.
Now I tried on a different pc,I install/unistall dozens of wamp versions , I don't have a clue what could be wrong
As the code says,I'm running it on the same computer ( localhost )

That's because you try to use short_open_tag (<? instead of <?php ) as your php openning tag in

<form action="<?=$_SERVER['PHP_SELF']?>" method="post">

while you probably have it set in your php.ini to off:
short_open_tag = Off

That's why, when you run the script, your form looks like this:

<form action="<?=$_SERVER['PHP_SELF']?>" method="post">

instead of

<form action="/path_to_your_file.php" method="post">

hence the error.

On your previous server (configuration) (2 months ago), you probably had short_open_tag = On , and that's why the same script worked.

Php reccomends in php.ini to avoid using short_open_tag in your scripts, exactly beacuse of this. On some servers this option is not enabled and you get in a lot of trouble, the way you did.

So, to solve your problem, try to use:

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


Hey thanks :) It worked . You we're right ,it was that short_hand thing.

You're the best

I think the reason it worked then didnt is did you upgrade?

a new version (i myself use XAMPP) came out recenly and the same thing happened to me. Seems they turned off the short tags as its the new default behaviour?

I've used wamp 1.5.0 , 1.5.0.a , 1.7.1 , 1.4.2
All of them have the short_open_tag = Off by default , and I guess that all future versions will have this as well
It can be really frustrating.
They should ask you when u install it , if you want short tag on/off