$value) { if(!preg_match('/.+/')) { $errors .= "You neglected to enter a value for field {$key}\n
"; } } //after all your user error checking is done do this if(isset($errors)) { echo $errors; ?>