+ 1
Kindly someone help its displaying:Undefined variable errors on line 1
<?php if (count($errors) >0):?> <div class="error"> <?php foreach($errors as $error):?> <p><?php echo $error; ?></p> <?php endforeach ?> </div> <?php endif ?>
2 Answers
0
If I get you right, the $errors is supposed to be an array containing errors and later be printed out with the <p></p> tag for each.
Try this:
<?php
$errors=['This is an error.','Another error!']; /* this is an array, containing errors */
if (count($errors) >0):
?>
<div class="error">
<?php foreach($errors as $error):?>
<p><?php echo $error; ?></p> <?php endforeach ?>
</div>
<?php endif ?>
0
Thankyou.Friend ...is it possible to show you more using the watsapp kindly.?Pranish!