Hi All,
I was wondering if anyone could help. I have a column in my database which contains a story. Now I want to take the first paragraph, and make it bold (which works!) and then with the rest of the paragraphs I just want a <p> tag around each line, but my output produces two unnecessary <p></p> tags (as shown below) with each new line.
Here’s my code, can anyone advise how I can rectify this problem?<p style="font-weight:bold">Open 24 hours a day, 365 days a year.
</p><p>
</p><p>lipsum text goes here
</p><p>
</p><p>And here is some more text that goes here and it will go here in this space here provided.
</p><p>
ThanksPHP Code:<?
$aParagraphs = explode("\n", $about);
echo '<p style="font-weight:bold">' . htmlspecialchars_decode($aParagraphs[0]) . '</p>';
for ($i=1; $i < count($aParagraphs); $i++) {
echo '<p>' . htmlspecialchars_decode($aParagraphs[$i]) . '</p>';
}
?>






Bookmarks