I was hoping someone could really help me on this one.
I have have been looking at it that long that I can not see the forest from the trees
I am trying to get the following code to work
<html>
<body>
<form method="post" action="
First name:<input type="Text" name="first"><br>
Last name:<input type="Text" name="last"><br>
Address:<input type="Text" name="address"><br>
Position:<input type="Text" name="position"><br>
<input type="Submit" name="submit" value="Submit">
</form>
<?PHP
If ($submit=="Submit" {
$db = mysql_connect("localhost", "root"
mysql_select_db("mydb",$db);
$sql = "INSERT INTO employees SET first='$_POST[first]',last='$_POST[last]',address='$_POST[address]',position='$_POST[address]'";
$result = mysql_query($sql);
echo "Thank you! Information entered.\n";
}
?>
</body>
</html>
I know the problem is with the "IF" statement as when I remove it, data will enter into the database. However with the "IF"statement gone I am getting an empty line every time I open the browser.
I have have been looking at it that long that I can not see the forest from the trees
I am trying to get the following code to work
<html>
<body>
<form method="post" action="
First name:<input type="Text" name="first"><br>
Last name:<input type="Text" name="last"><br>
Address:<input type="Text" name="address"><br>
Position:<input type="Text" name="position"><br>
<input type="Submit" name="submit" value="Submit">
</form>
<?PHP
If ($submit=="Submit" {
$db = mysql_connect("localhost", "root"
mysql_select_db("mydb",$db);
$sql = "INSERT INTO employees SET first='$_POST[first]',last='$_POST[last]',address='$_POST[address]',position='$_POST[address]'";
$result = mysql_query($sql);
echo "Thank you! Information entered.\n";
}
?>
</body>
</html>
I know the problem is with the "IF" statement as when I remove it, data will enter into the database. However with the "IF"statement gone I am getting an empty line every time I open the browser.