Hello,
I'm trying to prevent against users entering consecutive numbers in the phone number, and consecutive letters in the first and last name on a form.
I want to prevent a user from typing 717-222-3124 or 717-531-1111 (as examples)
Here's what I have for the phone numbers.
$phone1 = 717
$phone2 = 818
$phone3 = 3040
$pattern1 = "/^\d{3}$/";
$pattern2 = "/\d{4}/";
if (preg_match($pattern1, $phone2, $matches)) {
echo "$phone2 Phone 2 Invalid<br>";
}
else {
echo "$phone2 Phone 2 Valid<br>";
}
if (preg_match($pattern2, $phone3, $matches)) {
echo "$phone3 Phone 3 Invalid<br>";
}
else {
echo "$phone3 Phone 3 Valid<br>";
}
The problem is, it ALWAYS returns Invalid no matter what number I use
Any ideas? As a follow up, I'd like to do this for numbers to.
Many thanks!