faqts : Computers

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

2 of 2 people (100%) answered Yes
Recently 2 of 2 people (100%) answered Yes

Entry

php

Nov 12th, 2008 22:55
Asrar Khan, dman, i can do it, vijesh Nair, http://sturly.com


Simple and powerful international phone validation using php

//Here i am writing a fn for phone validation//just call thse fn in ur
//form it will work for eg: 92-758-4722822
//(first digits upto-2
 //second digits upto-3
 //phone no (5 to 9 nos) //this u can change for ur need  
//just copy this code and paste it in your form
//$field ="phone no in the text box
//$value =any text eg:(phone number) 
function phone_error($field,$value)
  {
          
   if(isset($_REQUEST[$field]))
    {
          
	  if(!ereg("^[0-9]{1,2}-[0-9]{1,3}-[0-9]{5,9}$", $_REQUEST[$field]))
	  {
          global $row_start; 
          echo  "<font color='red'1>$value can contain only numbers and
dashes</font>";
	      return true;
       
      }//fi1

  
    }//isset

  }//fn

http://www.goodtimepass.com
http://www.nighthawks.co.in
http://www.contactindianhotels.com
http://www.heritagehotelsinrajasthan.com