Jump to content

[SOLVED] Validation question


tqla

Recommended Posts

I use this script to validate phone numbers. It works fine but the client wants to be able to accept a period (.) as well as a dash (-) between numbers. Where do I add the period? Thanks.

 

/* check phone for invalid format. */
    elseif ($field == "telephone" or
		$field == "mobile")
    {
      if(!ereg("^[0-9)( -]{7,20}(([xX]|(ext)|(ex))?[ -]?[0-9]{1,7})?$",$value))
      {
           $bad_format[] = $field;

 

Link to comment
https://forums.phpfreaks.com/topic/87423-solved-validation-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.