I'm working on a project and I'm having a bit of trouble getting my form data to post to my SQL database. At first the auto inc ID values were working any time I'd submit the form, but no other data would post... now nothing at all happens... I'm very rusty with php... anyways here is what I have so far.
insert.php
<?php
include ("connect.php");
$sql = "INSERT INTO 'tc_db'.'teamchiefs' ('lastname', 'firstname','unit','datecert','initial')
VALUES ('$_POST[lastname]','$_POST[firstname]','$_POST[unit]','$_POST[datecert]')";
if (!mysqli_query($con,$sql))
{
die('Error:' . mysqli_error(@con));
}
echo "Record Added";
mysqli_close($con);
?>
And my form.html file... clipped down to save space.
<body>
<ul>
<form action="insert.php" method="post">
"sprytextfield1">
<label>Last Name:
<input type="text" name="lastname" id="lastname" />
</label>
<label>First Name:
<input type="text" name="firstname" id="firstname" />
</label>
<label>Middle Initial
<input name="initial" type="text" id="initial" size="5" maxlength="1" />
</label>
...etc
//spry widget javascript stuff here
</form>
</ul>
</div>
</body>
My sql tables are
ID - BIGINT(20) - A_I
lastname - VARCHAR(60)
firstname - VARCHAR(60)
unit - VARCHAR(6)
datecert - YEAR(4)
initial - VARCHAR(1)
I appreciate any help.