Including form validation with insert behavior
I have added my form validation but now I am trying to use the insert function. The validations are working but it is not inserting to the database. Am I missing something?
I have added my form validation but now I am trying to use the insert function. The validations are working but it is not inserting to the database. Am I missing something?
It looks like it should work... to debug I'd add this code after the ->execute() line:
var_dump($InsertQuery);
die();
That should:
1) tell you if it is getting into the IF statement and trying to do the insert at all
2) show you any errors that might be occurring
Hi Ray, I added that code that you suggested but there are no errors coming up. Any suggestions?
I have several pages that have forms that need validation/email/insert, so if I can get this page up and running then I can do the others.
Does anything show up? If not, then it isn't getting into you IF statement...
Maybe at the end add an else statement between the two close brackets so instead of:
}
}
use:
} else {
echo(empty($emailErr)?"":"has emailErr<br>");
echo(empty($workErr)?"":"has workErr<br>");
echo(empty($generalErr)?"":"has generalErr<br>");
echo(empty($projectnameErr)?"":"has projectnameErr<br>");
echo(empty($cityErr)?"":"has cityErr<br>");
echo(empty($stateErr)?"":"has stateErr<br>");
echo(empty($aboutprojectErr)?"":"has aboutprojectErr<br>");
echo(empty($projectdescrErr)?"":"has projectdescrErr<br>");
echo(empty($budgetErr)?"":"has budgetErr<br>");
echo(empty($durationErr)?"":"has durationErr<br>");
echo(empty($foundErr)?"":"has foundErr<br>");
echo(empty($salesrepErr)?"":"has salesrepErr<br>");
die("validation failed");
}
}
Our Data Bridge product has a very robust validation system that you could use rather than writing your own like you have. I would suggest using it in the future to make validation cleaner and easier to debug.
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.