** $errors array is the erros that will give when the user enters invalid form data, so i wish to style the $errors array below? how can i do that ? like i want to colour it and do some styling **
if($_SERVER['REQUEST_METHOD'] == "POST"){
$errors = array(); // create an errors array to record errors if any.
// check if the name is provided and is valid
if(empty($_POST['Make1'])) {
$errors[] = 'Make 1 is required.'; // if name is required
} else {
$Make1 = trim($_POST['Make1']);
if (!preg_match("/^[a-zA-Z ]*$/",$Make1)) {
$errors[] = "Invalid Make1! use only letters and white space.";
}}
if (empty($_POST['Make2'])) {
$errors[] = 'Make 2 is required.';
} else {
$Make2 = trim($_POST['Make2']);
if (!preg_match("/^[a-zA-Z]*$/",$Make2)) {
$errors[] = "Invalid Make 2! use only letters and white space.";
}}
echo implode(PHP_EOL, array_map(fn($e) => "<div class=error>{$e}</div>", $errors));