Hi Everyone, I put together this little db insert and I can't figure out where it's going wrong. Everything works except it is inserting blank records and not the contents of the filled out form. Here's the code. It seems I'm missing something, like aImissed a step or something, but I followed a previous example except I had to change the sql to INSERT instead of UPDATE, could it be failing because I am not adding the auto increment field? If so would that be done by inserting a NULL in the sql statement?
<?php
function input_form(){
$conn = my_conn();
mysql_select_db("students", $conn);
$insert = "INSERT INTO students";
$insert .= "First = '" . $POST['First'] . "', ";
$insert .= "Middle = '" . $POST['Middle'] . "', ";
$insert .= "Last = '" . $POST['Last'] . "',";
$insert .= "Birthdate = '" . $POST['Birthdate'] . "',";
$insert .= "Address = '" . $POST['Address'] . "',";
$insert .= "City = '" . $POST['City'] . "',";
$insert .= "State = '" . $POST['State'] . "',";
$insert .= "Zip = '" . $POST['Zip'] . "',";
$insert .= "Country = '" . $POST['Country'] . "',";
$insert .= "EMail = '" . $POST['EMail'] . "'";
$result = mysql_query($insert, $conn);
if (!$result) {
echo("<p>Error performing query: " . mysql_error() . "</p>");
exit();
}
echo
"<form action='$_SERVER[PHP_SELF]' method='post'>
First Name: <input type='text' name='First' size='25' maxlength='25' />
Initial: <input type='text' name='Middle' size='1' maxlength='1' />
Last Name: <input type='text' name='Last' size='25' maxlength='50' />
Birthdate: <input type='text' name='Birthdate' size='25' maxlength='50' />
Address: <input type='text' name='Address' size='25' maxlength='50' />
City: <input type='text' name='City' size='25' maxlength='50' />
State: <input type='text' name='State' size='25' maxlength='50' />
Zip: <input type='text' name='Zip' size='25' maxlength='50' />
Country: <input type='text' name='Country' size='25' maxlength='50' />
E-Mail: <input type='text' name='EMail' size='25' maxlength='50' />
<input type='submit' name='Submit' value='Register' />";
}
?>
Thanks,
David M.