akimm wrote:but it allows submissions with no values entered at all. I'm sincerely confused as to how we can solve this.
I am refering to the bolded part in the quoted string. PHP is a
server-side scripting language...so, how could you expect PHP to validate your form
without submitting the data first ? If what you want is to
prevent submit after the validation process is completed,
that must be on the client side and use Javascript.
My code and everybody's codes here don't prevent form submissions, but our codes don't
process inputs into the database. Our codes here are for validating and not for processing.
The most important thing is:
- If satisfied conditions are not met, the data should not be INSERTED (PROCESSING) into the database, but you should validate and validate the data until the satisfied conditions are met, then you program PHP to INSERT the satisfied data into the database.
I recommend to use BOTH Javascript and PHP form validation for your solution as quoted from
http://www.zend.com/zend/tut/tutorial-m ... c=0&view=1:
To prevent any kind of intrusion, your best companion is always PHP. Even though you have utilized Javascript, never skip checking data with PHP. This is the most reliable checkpoint before processing input.
And if the user turns off the javascript, your PHP code would still be executed.
Good Luck,
Chris