Form Validation Library v0.1 by Matthew Worthey Created on 2004-10-21 Works in PHP 4 and 5; probably earlier version as well, though not tested. Find more Web design resources at www.dognosedw.com Use or change this library as you wish but credit me if possible. Thanks! Functions and example usage: ---------------------------- Function: formatPhone( $phone ) Formats a phone number to the form "234 555-1234". It basically pulls the numbers out of a string and formats them, so any other characters (punctuation, letters, etc) are ignored. Any numbers after the 10th number are ignored. Receives: A string containing 10 or 7 numbers and any other characters, by value. Returns: If the string contains 10 (area code) or 7 (no area code) numbers, the formatted phone number is returned. Else returns the original string. Example usage: $phnum = "(222) 555-4433"; $newPh = $formatPhone($phnum); The string $newPh now contains "222 555-4433". ----------------------------- Function: isValidEmail( $email ) Checks if an email address is well formed; that is, it follows the form "a@b.c". a, b, and c can each be one or more characters. Receives: A string, the email address to be validated, by value. Returns: Boolean true or false. Example usage: $em = "matthew@dognosedw"; // notice I forgot the ".com" if( !isValidEmail($em) ) echo "Please enter a valid email address."; Prints "Please enter a valid email address." to the screen. -----------------------------