I am trying to post from a form to table using the code below from file2.php
and having two problems:
1. The data is not being posted to the table
2. After submit is pressed the following message comes up: "The page cannot
be displayed" - The browser can't find the file, because it is looking for
http://file2.php instead of http://teachercards.org//file2.php
Any help would be greatly appreciated.
TIA
David
<html>
<body>
<?php
if ($_Post['submit']) {
$conn = mysql_connect("mysql", "TeacherCards", "164333") or die("Cannot
connect to server");
mysql_select_db("Teachercards",$conn) or die("Cannot find database");
$sql = "INSERT INTO Teachers2 (Name, College, Subject)
VALUES('$_Post[Name]', '$_Post[College]', '$_Post[$Subject]')";
$result = mysql_query($sql);
}
Else
{
// display form
?>
<form method="post" action="<?php echo $PHP_SELF?>">
Name:<input type="Text" name="Name"><br>
College:<input type="Text" name="College"><br>
Subject:<input type="Text" name="Subject"><br>
<input type="submit" name="submit" value="Enter information">
</form>
<?php
}
// end if
?>