i am working on a contact form and so far all is well but i need to know how can i create a function in php that requests the answer to be and only be “yes”?
i got a question that states 'are you human?" this isn’t the best way for security but it does trip some bots up.
also i have a phone number but i need the phone number to be in a specific format ie xxx-xxx-xxxx
how can i set it up? i found on google for email:
if(trim($_POST['email']) == '') {
$hasError = true;
} else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\\.[A-Z]{2,4}$", trim($_POST['email']))) {
$hasError = true;
} else {
$email = trim($_POST['email']);
}
but nothing on phone numbers. please help