Quote:
Originally Posted by iioacademy
It can either be validate thru js or php,
but I suggest javascript, for it is browser based, that means
|
Never do "js
or php" validation, you can do PHP or both. If user has JS disabled then all goes to the script without checking, which is bad.
eregi function suggested by Pandadan is deprecated.
PHP has built-in filter method to validate strings like emails and urls, which is filter_var(), so you could use:
PHP Code:
if ( !filter_var($mailVar, FILTER_VALIDATE_EMAIL) ) {
echo 'Wrong e-mail address!';
} else {
emailIsCorrect();
}