If you don't want to catch all errors individually, why not use an Array() of errors you might encounter? This function accepts an array, loop through each of them then return it as display. This snippet is pretty much useful and save spaces.
function form_errors($errors=array()){
$output = "";
if(!empty($errors)){
$output .= "<div class = \"error\">";
$output .= "Please fix the following errors: ";
$output .= "<ul>";
foreach($errors as $key => $error){
$output .= "<li>{$error}</li>";
}
$output .= "</ul>";
$output .= "</div>";
}
return $output;
}
Labels: PHP, Scripts