I completed the first three tutorials on Zend's website and I had tested out all the scripts just fine. I got to one tutorial that used $SERVER['PHP_SELF'] and I started getting the 403 Forbidden error. Environment is PHP/Apache/Windows. Script is as follows: <html>
<head></head>
<body>
<form method="post" action="<?php echo $
SERVER['PHP_SELF']; ?>">
Enter number of rows <input name="rows" type="text" size="4"> and columns <input name="columns" type="text" size="4"> <input type="submit" name="submit" value="Draw Table">
</form>

<?php

if (isset($POST['submit'])) {
echo "<table width = 90% border = '1' cellspacing = '5' cellpadding = '0'>";
// set variables from form input
$rows = $
POST['rows'];
$columns = $_POST['columns'];
// loop to create rows
for ($r = 1; $r <= $rows; $r++) {
echo "<tr>";
// loop to create columns
for ($c = 1; $c <= $columns;$c++) {
echo "<td>&nbsp;</td>\n";
} echo "</tr>\n";
}
echo "</table>\n";
}

?>

</body>
</html>
ERROR IS: Forbidden
You don't have permission to access /test/< on this server.

    Doesn't look like PHP is getting parsed correctly.

    Look in the source of the HTML page - what do you see in between the action="" ?

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

        Well the syntax doesn't look wrong... does the script you're running this code in end in file extension .php ?

        If so, can you post us a link to this script you have up?

          No, the script is called test.html. Ok, just renamed it to a *.php and it worked fine... Thanks! YOU DA MAN!!!!!

            No problem. Don't forget in the future - your webserver is only setup to parse PHP in files that end in .php (possibly other extensions like .php5 or .php3 or a php-source file such as .phps), so any other extension won't even trigger the PHP interpreter.

            Also, don't forget to mark this thread resolved! 🙂

              I guess this really qualifies me as a NEWBIE!!!!! :-)

                Write a Reply...