This ones pretty simple. If you’ve ever wanted to make sure you get a real e-mail address through your input forms, a good way to check an address is by using the following e-mail validation.

if (!eregi(”^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$”, $email)) {
//code here

This code will check to make sure that the variable “$email” is in an e-mail format. To customize this, you would just change, $email to whatever variable you are using. Give it a try!

Leave a Reply

Enter Code (required)

  Copyright © 2009 Snidge.com. All rights reserved.