Having a problem. I cannot seem to get data to enter into my database. When you enter information, and then click submit, it process like it takes the data and sends it to the data base, but you dont get the message at the end letting you know that the data was submitted successfully. Getting really frustrated!!!!
below is the code:
<html>
<body>
<?php
if ($submit) {
// process form
$db = mysql_connect("localhost", "root", "root");
$dbsel = mysql_select_db("mydb",$db);
mysql_select_db("mydb",$db);
$sql = "INSERT INTO employees (first,last,address,position) VALUES ('$first','$last','$address','$position')";
$result = mysql_query($sql);
echo "Thank you! Information entered.\n";
} else{
// display form
?>
<form method="post" action="<?php echo $PHP_SELF?>">
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="Enter information">
</form>
<?php
} // end if
?><BR>
</body>
</html>
Please take a looksie and see what all you guys/gals can figure out. I dont see what is wrong!
thanks,
Todd