I am having trouble getting my php code below to work.
All i want it to do is insert the data recived by the form into my database.
I am running windows 2000 and using Apache.
<html>
<title> Submit a Strategy </title>
<body bgcolor="#00000" text="#FFFFFF">
<h1> SUBMIT YOUR OWN STRATEGY! </h1>
<?php
if (isset($_POST["submit"])) {
$db=mysql_connect("localhost", "root","pass");
mysql_select_db("test",$db);
$sql = "INSERT INTO strat (name, race, subject, strat) VALUES ('$name','$race','$subject','$strat')";
$result = mysql_query($sql);
echo "Thank You! Your strategy has been submited.\n";
}
else {
?>
<form method="post" action="<?php echo $PHP_SELF?>">
Name: <br><input type="text" name="name"><br>
Race: <br><input type="text" name="race"><br>
Subject: <br><input type="text" name="subject"><br>
Strategy: <br><textarea rows="20" cols="50" name="strat"></textarea><br>
<br>
<input type="submit" name="submit" value="Submit Your Strategy">
</form>
<?PHP
}
?>
</html>
When I try to enter text into the form and hit submit, i get the following Error ---
Forbidden
You don't have permission to access /<br /><b>Notice</b>: Undefined variable: PHP_SELF in <b>c:/program files/apache group/apache/htdocs/submit.php</b> on line <b>19</b><br /> on this server.
I am able to insert values into my table via the mySQL promt in the DOS promt.
I dont know if its something wrong with my code or if there is some sort of permission setting in mySQL that is screwing things up.
Thanks for any help!!