I have the following code that checks to see that the email is correct.
How do i alter the phone one to check that it contains at least 9 numbers?
TIA
How do i alter the phone one to check that it contains at least 9 numbers?
PHP:
//Check to make sure sure that a valid email address is submitted
if(trim($_POST['email']) === '') {
$hasError = true;
} else if (!preg_match('^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+$^', trim($_POST['email']))) {
$hasError = true;
$errorMessage = "Please enter a valid email address!";
} else {
$email = trim($_POST['email']);
}
//phone
if(isset($_POST['phone'])) $phone = trim($_POST['phone']);
TIA