...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'!


Profile image!
By: Stephen

  More about PHP

  Reply to How To Validate An Email Address

  Receive Our Newsletter

  Send to friend

PHP picture



Questions about PHP:

Ask question

More Articles:
Ideas for free gifts for your customers
How to Speed Boot When Networking
How to Have Windows Remind You About Pending Updates