I have following code for, checking whether the input number is;
- Empty or not.
- is number or not.
- is 8 digit or not.
But cant figure out. If the input is not 8 or 6 digit, it suppose to give error.
if ($_POST['phone']==''){
$has_errors=true;
$errors[]=__('Phone field is empty','wpestate');
}
else if(!is_numeric($_POST['phone'])) {
$has_errors=true;
$errors[]=__('Phone number entered was not numeric','wpestate');
} else if(strlen($_POST['phone']) != 8) {
$has_errors=true;
$errors[]=__('The number entered was not 8 digits long','wpestate');
}
Aucun commentaire:
Enregistrer un commentaire