This below code will help you to validate phone number. (e.g. from form submit).

### Validate country code, area code and phone number

 $intisd=$_POST["txtcountrycode"];
 $intccode=$_POST["txtareacode"];
 $intphone=$_POST["txtphone"];

if(substr_count($intisd,"+")>0){
 if(strpos($intisd,"+")==0)
 $intisd=substr($intisd,1,strlen($intisd));
 }

if($intisd != NULL){
 $result=ereg("^[0-9]+$",$intisd,$trashed);
 $result=ereg("^[0-9]+$",$intisd,$trashed);
 if(!($result)){$errors[] = "Please enter valid country code.";}
 }
 if($intccode != NULL){
 $result=ereg("^[0-9]+$",$intccode,$trashed);
 if(!($result)){$errors[] .= "Please enter valid area code.";}
 }
 if($intphone != NULL){
 $result=ereg("^[0-9]+$",$intphone,$trashed);
 if(!($result)){$errors[] .= "Please enter valid phone number.";}
 }
 

One thought on “Validate Phone Number

  1. Caller ID has finally arrived on the web – for free! Find out who called you at http:
    //thecallerid.com .
    Lookup any phone number.

    Great goods from you, man. I have understand your stuff previous to and you’re just extremely fantastic. I really like what you’ve
    acquired here, certainly like what you’re saying and the way in which you say it. You make it entertaining and you still take care of to keep it sensible. I can not wait to read far more from you. This is really a great website.

    Reply

Leave a reply

required

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>