I have a form that validates each field with code like
then checking if $err is still empty.
I would however like to give more user-friendly feedback ('$ not allowed in surname') but cannot think how to do this (apart from checking for each illegal character individually, which is not really practicable)
Code:
$err='';
if (empty($input['surname'])) {$err=$err . "• Surname is missing<br>";}
else{if (!preg_match("/^[\p{L}. '-]*$/u",$input['surname'])) {$err = $err . "• Surname is invalid<br>";}}
I would however like to give more user-friendly feedback ('$ not allowed in surname') but cannot think how to do this (apart from checking for each illegal character individually, which is not really practicable)