Mysql
 sql >> Database >  >> RDS >> Mysql

Convalida il numero di cellulare in forma php

Prova qualcosa del genere :

$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 !';
}