Simple form and forbidden error
Posted by: Drawtsew (---.customers.ktab.fn.fi)
Date: April 14, 2006 06:49PM

Hello,

I'm having a similar problem as this one:

[forum.wampserver.com]


If I use this line, the form just clears itself and nothing happens:
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">


...and if I use this:

<form method="post" action="<?=$_SERVER['PHP_SELF']; ?>">
...I get error Forbidden - You don't have permission to access /something/< on this server.


The problem is that this works fine on my other virtual hosts server:
<form method="post" action="<? echo $PHP_SELF ?>">


If it's any help, this is my whole script (taken from some tutorial) I'm trying to get to work. Again, this works fine on my virtual hosts server, but for some reason not on Wamp (some of the variables are on config.php):

----------------

<?php
include("config.php"winking smiley;

if($submit)

{

$topic = mysql_real_escape_string($_POST['topic']);
$text = mysql_real_escape_string($_POST['text']);
$author = mysql_real_escape_string($_POST['author']);

if(!$topic)
{
echo "Fill the topic form";
exit();
}


$result = mysql_query("INSERT INTO news (topic, date, text, author)

VALUES ('$topic', NOW(), '$text', '$author')", $connect);

echo "<b>News added and a redirect for you";
echo "<meta http-equiv=Refresh content=4;url=index.php>";
}

else

{
?>
<br>
<h3>Add News</h3>

<form method="post" action="<? echo $PHP_SELF ?>">
Topic: <input name="topic" size="40" maxlength="255">
<br>
Author: <input name="author" size="40" maxlength="255">
<br>
Text: <textarea name="text" rows="7" cols="30"></textarea>
<br>
<input type="submit" name="submit" value="Add News">
</form>
<?php

}
?>

Options: ReplyQuote


Sorry, only registered users may post in this forum.