Home › Forums › Back End › PHP form validation example. Secure or not secure? › Re: PHP form validation example. Secure or not secure?
November 29, 2011 at 12:59 pm
#91521
Member
Is there a way to condense this validation? I can’t find any examples…
if(empty($phone)){
$errors = '*';
} else {
if ($phone == "Phone") {
$errors = '*';
} else {
if (strlen($phone) < 10 ) {
$errors = '*';
} else {
if (strlen($phone) > 15 ) {
$errors = '*';
} else {
if (is_numeric($phone)){
//do nothing
} else {
$errors = '*';
}
}
}
}
}