I have a php script running which is checking that information in a form has been entered and that the form hasn't been by passed however when submit is clicked and the script is run I get the last error message saying 'You must complete the form' even though the form is completed, can anyone spot an error anywhere?
<?PHP
if (isset($_POST['title']) && isset($_POST['director']) && isset($_POST['certificate']) && isset($_POST['category']) && isset($_POST['format']) && isset($_POST['condition']) && isset($_POST['description']) && isset($_POST['image']))//returns true if the variable exsists, to see if the user has bypassed the form
{
$title = trim($_POST['title']);
$director = trim($_POST['director']);
$cert_id = trim($_POST['certificate']);
$format_id = trim($_POST['format']);
$condtion_id = trim($_POST['condition']);
$description = trim($_POST['description']);
$iamge = trim($_POST['image']);
if ($title != "" && $director != "" && $cert_id != "" && $format_id != "" && $condition_id != "" && $description != "" && $image != "")//checking if the fields have been filled in by the user
{
$sql_addProduct = "INSERT INTO products (title, director, cert_id, cat_id, format_id, condition_id, user_id, description, image, date_added) VALUES ('$title', '$director', '$cert_id', '$cat_id', '$format_id', '$condition_id', `user_id`, '$description', '$image', NOW()) WHERE `user_id` = '".$_SESSION['user_id']."'";
$queryresult_add = mysql_query($sql_addProduct);
echo"<h1>Record Added</h1>";
}
else
{
echo "<p>You have not entered all of the required fields </p>\n";}//If a field has not been entered then this message will be displayed
}
else
{
echo "<p>You must complete the form</p>\n";
}//If the user has bypassed the form then this message will be displayed
?>