Hi,
I have a php page that has a form that's supposed to gather data to add a new record to a database. What happens is that when I click on submit, it does add a new record, but none of the fields are populated (except the primary key, which is a field called id that auto-increments). Does anyone know what might be causing this? I'm pretty new to this so I'm thinking it may be something pretty easy that I'm overlooking. Here's the PHP part of the code:
<?php }
if( isset($_POST['submit']) ){ // Submit Button Has Been Pressed
// Instantiate MySQL Object
$db = new MySQL(DBHOST,DBUSER,DBPASS,DBNAME);
// Store Record
$sql = "INSERT INTO professional SET prof_id='$id', name='$name', phone='$phone', address='$address', city='$city', state='$state', zip='$zip', fax='$fax', email='$email'";
$result = $db->query($sql);
if( !mysql_error() ){
// No Error, Query Succeded
// Set Success Message & Redirect
session_start();
$_SESSION['message'] = "Record Successfully Stored";
header("Location:contactAdmin.php");
}else{
// Error: Storing File Meta Data Failed
echo "<h2>Query Failed</h2>";
echo mysql_error() . "<br /><br />";
echo $sql . "<br />";
} // End Query Success Check Conditional
}else{
showForm();
} // End Conditional: Process or Show Form
?>