Hi all, I have a form that is sending data to a MySQL database and I want to make sure several of the fields are not left blank. I think I can figure out how to do this with JavaScript, but my question is should I? When I made the database table that I am working with I made the fields that I want to make sure are filled out NOT NULL
to ensure I would at least get a MySQL error when they were left empty (I also realize that "empty" and NULL
are not the same thing).
My question is, should I check to see if fields are empty/null with JavaScript before the form is submitted, or should I let the user attempt to submit the form and then base my corrective action on what every MySQL error I get back?
And a second question, if I do the first (check with JavaScript) what is the point of creating some fields NULL
and some fields NOT NULL
in my database if I am going to be catching all the possible "errors" with JavaScript before the submitted form hits the database?