...Beauty, cleaning, DIY tips and more - free to join!
   Login   Contact us   Site map   Puzzle Club   Ask a question    Newsletter

How To Validate An Email Address

Computing : Learning PHP

One of the biggest problems with any form is one that collects email addresses.

Wary of receiving lots of spam, people will tend to put any old rubbish in this box.

In order to check it is a proper address then the best you can do is check that it appears to be in a valid format.

To do this, you'll need to check against an ereg expression of a valid email address.

Here is a simple ereg you can use which will work in most cases:
"[^@ ]+@[^{ ]+.[^@ .]+$"

Basically, it passes an address as valid if it meets the:
something@something.something format, and checks that the at is not in the right place and there are at least some characters to represent the 'somethings'!


By: Stephen

Share on Facebook: On Twitter: TwitterTweet this!

  Reply to How To Validate An Email Address

  Receive Our Newsletter




Questions about PHP:

Ask question

More Articles:
How to Add a Map Drive Button to the Toolbar
How to read a word document using PHP
How to understand a webpage