Question Detail

pattern="^\d+(?:\.\d{1,2})?$"

I have done this but its not working


Thread Reply

Anonymous

- 1 years ago

please elaborate your question.
I am not getting you.

Anonymous

- 1 years ago

  1. function phonenumber(inputtxt)  
  2. {  
  3.   var phoneno = /^\d{10}$/;  
  4.   if((inputtxt.value.match(phoneno))  
  5.         {  
  6.       return true;  
  7.         }  
  8.       else  
  9.         {  
  10.         alert("message");  
  11.         return false;  
  12.         }  

Anonymous

- 1 years ago

Try something like this :

$phoneNumber = $_POST['mobileno'];

if(!empty($phoneNumber)) // phone number is not empty
{
    if(preg_match('/^\d{10}$/',$phoneNumber)) // phone number is valid
    {
      $phoneNumber = '0' . $phoneNumber;

      // your other code here
    }
    else // phone number is not valid
    {
      echo 'Phone number invalid !';
    }
}
else // phone number is empty
{
  echo 'You must provid a phone number !';
}

Anonymous

- 1 years ago

pattern="^[0-9\-\+\s\(\)]*$" 
 

Try this it may help you :)

Anonymous

- 1 years ago

have u found any answer