I am having trouble inserting data to my table via PHP. The "cc_connect.php" is the file that connects the database. The form is there but when I submit it, no data is added to my table. I've followed several tutorials and matched their methods without success. Is something not set up in my db?
the function $dbcon is associated with my connection
<form method="post" action="cc_registration.php">
<input type="hidden" name="submitted" value="true" />
First Name: <input type="text" name="first_name" />
Last Name: <input type="text" name="last_name" />
<br />
<input type="submit" value="submit" />
<?php
if(isset($_POST['submit'])) {
include ('cc_connect.php');
if (!$dbcon) {
die("Can not Connect: " . mysql_error());
}
mysql_select_db("cooperstown",$dbcon);
$sql = "INSERT INTO cobra_registration (first_name,last_name) VALUES ('$_POST[first_name]', '$_POST[last_name]')";
mysql_query($sql,$dbcon);
mysql_close($dbcon);
}
?>