Ok - long story short. I have no formal training with programming besides a few intro classes in college(6+ years ago). Mainly from on the job work and learning on my own..so I am trying to start a project for grad school and am stuck...
1) I created a mysql db called "myphr" and a table called "form_data" with id,name and email as the elements in the table
2) I created a "form.html" web form to have some put in their name and email to submit to the data base:
<html>
<body>
<form method="POST" action="formindb.php">
Your Name: <input type="text" name="name" />
E-mail: <input type="text" name="email" />
<input type="submit" />
</form>
</body>
</html>
3) I created a formindb.php file to process this html form to mysql. Here is where I click submit and nothing happens - just opens a web page (or text file if I remove the html tags) and nothing gets submitted to mysql but no errors on what I am doing wrong - what isn't working, etc....
<html>
<body>
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("myphr", $con);
$sql="INSERT INTO form_data (name, email)
VALUES
('$POST[name]','$POST[email]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
</body>
</html>
I am at a loss if some set up is wrong with mysql or my php file...I am using xampp on my pc to set up the db, etc. Any help would be GREATLY appreciated - Thanks in advance