I have this code to check if it is a numeric value and I already tried that the maximum value of digits were 9. I also tried with! = or ==
What I've tried:
Option 1
//php verif phone
if(isset($_POST["phone"])){
if (strlen($phone) != 9) {
if (!$phone) {
$errors[] = "Indique um número válido.";
}elseif ( !is_numeric( $phone )) {
$errors[]= "Verifique novamente o número.";
}
}
Option 2
//php verif phone
if(isset($_POST["phone"]) != 9){
if (!$phone) {
$errors[] = "Indique um número válido.";
}elseif ( !is_numeric( $phone )) {
$errors[]= "Verifique novamente o número.";
}
}
Option 3
//php verif phone
if(isset($_POST["phone"])){
if (!$phone) {
$errors[] = "Indique um número válido.";
}elseif ( !is_numeric( $phone ) != 9) {
$errors[]= "Verifique novamente o número.";
}
}
I've been looking here and see google and supposedly for what I read should give. But so far compels me to have 10 digits, not 9 as is my goal.
<label for="phone"></label>
<input name="phone" type="tel" id="phone" size="9"
value="" placeholder="Telemóvel"
class="required digits" title="Verifique novamente o número.">