> I was wondering if there is a way to check for spaces inside an email address?
There are several ways of validating an email address (from a syntactical standpoint).
I've used something like this in the past, and it works pretty well.
Code:
function is_email($email)
{
return ereg("^[^@ ]+@[^@ ]+\.[^@ ]+$", $email);
}
If you just want to check for the presence of space, do something like the following:
Code:
if (strstr(trim($email), ' '))
{
// The email contains single space characters
}
else
{
// The email does not contain space characters
}
(This doesn't find tabs BTW)
HTH!
Regards,
Rich
--
[
http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design