How can I do as the program stop running if error is detected? Use
exit() instead?
Karl
exit() will terminate processing. Nothing here will stop the program.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstu...@attglobal.net
==================
Aside from the main question: why do you think you need at least 8 chrs
in a address? x...@hp.nl can be a valid address....
--
]-[oRus
www.smallsystemservice.nl
Why do you want to "stop"? Isn't it better that you validate all input first
and then tell the user all the faults, instead of "fixing" things, they will
get yet another error message.
exit() is a bad way to terminate the execution, it will cause a lot of
aesthetic troubles (you will still make your error output look nice as the
rest of the site) and you can't validate all data, only one at the time if
there are more than one faulty and you may expose more to the end user than
you will (example exit(mysql_error()); is a bad thing to do).
As others already pointed out, the less than 8 characters for email address
will filter out quite many valid ones, most of my email addresses on one of my
domains would not be validated this way and it seems like you will have even
more false positives tooif you only use the length as a way to check. I would
have used a regular expression check, that way I don't have to check for a
minimum email length of 5 characters.
Read this for further information: http://www.linuxjournal.com/article/9585
--
//Aho
I was playing around with
filter_var($var,FILTER_VALIDATE_EMAIL)
a@b.c validates
It is probably better to let invalid addresses go through than to filter out
valid ones
MG