Thanks for your thoughts.
yeah, I guess I probably do not need the rtrim() in the CleanArray function. I think I put it in there a long time ago, cause for some reason trim wasn't removing all the white space from form inputs.
None of the inputs need html tags or anything in them, so that is why I chose strip_tags(), but I will look in to the other functions,htmlspecialchars() and htmlentities().
that is a nice way of shortening the code, it does look better. I am confused about the !== though, but I haven't picked up on when to use like == or ===, I guess I haven't got my head wrapped around the difference.
I might research a way to have the function do even more for me. It didn't really save lines of code in my file. I still use code like
if(!CheckVar($var['first_name'], 'name')) {
$error['first_name']='Please enter a valid First name.';
$error_count=1;
}
each input has it's own error message, so i can put the message by the field instead of all of them at the top. I also have them in an array, so right before I load the form again to show the errors, I loop through all the array values and add the div and class html stuff to them. maybe that is extra processing for really nothing, but then it makes it easier to change if need be. Only need to do it in one place instead of for 15 different fields.
Anyways, that is getting away from the original form validation functions.
Think what I have will block most bad stuff? I'll add the mysqli_real_escape_string() before adding the info into the database.
Thanks,
Michael