I think it is possible to control such type of errors:
suppose that the name of your submit button is submit.
if(isset($submit)){
if($var1 == "" or $var2 == "" or ...){
print "Error message";
else {
run your script to insert your data to the database
}
}
Where $var1, $var2, .. stand for your variables carrying values which are added to the database.
Solomon