Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End PHP form validation example. Secure or not secure? Re: PHP form validation example. Secure or not secure?

#91521
standuncan
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 = '*';
}
}
}
}
}