I want to display all the errors stored in $error in an unordered list format. The following is the code that will display the errors.
<?php
if (!empty($error)) {
echo '<p class="error"><strong>Your message was NOT sent<br/> The following error(s) occurred:</strong><br/>'. '<li>' . $error . '</li>' . '</p>';
} elseif (!empty($success)) {
echo $success;
}
?>
The problem is that the above code only display the first error in a list but rest of them are just showing in a separate line with no list format. All the errors are stored in the following format:
$error .= "You didn't type in your name. <br />";
I tried removing br tags but that didn’t work.
Any help would be much appreciated.
Thanks in advance 🙂
1 Answer