Skip to main content
August 11, 2010
Question

php email validation

  • August 11, 2010
  • 1 reply
  • 419 views

I don't want to use javascript to check my forms for accurate data input from users, be it required fields or correct data formatting.  Does anyone have any easy to apply method to check email addresses that wraps the insert statement in an if/else?  right now i'm using

if(eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$", $_POST['email']) == false){ $missingemail = true;}

which works.... but i find it hard to believe this would be the best solution.

had anyone used zend frameworks classes at all for this... or something else? thanks

This topic has been closed for replies.

1 reply

August 11, 2010

php/mysql by the way.

there are entire classes that do this, and they check far more then whether the @ sign is present or includes also a period. 

javascript form checking, while novel and take a minute to implement, are not really protecting anything.  I'm hoping to find a recommendation that others have used successfully.  Perhaps even a code snippet that was created that can be easily incorporated into dreamweaver as this should be a common practice with all forms.

also, now that cs5 incorporates code hints for the zend framework, perhaps the use of of the input/filtering classes, and even checking required fields in general as well.  thanks in advance.