+ 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 ?>

6th Feb 2018, 11:47 AM
rg brandske
rg brandske - avatar
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 ?>
6th Feb 2018, 12:00 PM
dunfc
dunfc - avatar
0
Thankyou.Friend ...is it possible to show you more using the watsapp kindly.?Pranish!
6th Feb 2018, 12:02 PM
rg brandske
rg brandske - avatar