Forum Moderators: coopster
A problem arises when there are extra returns at the end of the stored text, which means the bulleted list has extra bullets at the bottom of the list without any adjoining text.
Here is the code:
<?php
if (!empty($row_rsHomePage['mt_list'])) {
$thelist = nl2br($row_rsHomePage['mt_list']);
$newlist = explode('<br />', $thelist);
echo '<ul>';
foreach($newlist as $val) {
echo '<li>'.$val.'</li>';
}
echo '</ul>';
}
?>
As you probably already guessed I'm somewhat of a newbie at this.
Is there a PHP code that will remove the excess <br /> at the end of the file where there is not text? I've tried rtrim & trim without any change. It seems that it will work with whitespace, but not with '<br />'.
What would you suggest?