I have an issue that I’m not sure how to solve. Essentially, I have a textarea on my form that allows the user to enter data in this format:
Windows XP Home and Professional<br />(32 and 64 bit)
Windows 7 Home and Professional<br />(32 and 64 bit)
I can insert this into my database and retrieve/display it with no issue using nl2br in PHP. However, I need to format the output with some HTML. I essentially need the output to look like this in HTML:
<p class="smallText">Windows XP Home and Professional<br />(32 and 64 bit)</p>
<p class="smallText">Windows 7 Home and Professional<br />(32 and 64 bit)</p>
Essentially, when there is a single return, I need the br tag which nl2br will take care of for me. But where there is a double return, I need to convert the br to the opening and closing p.
I would sincerely appreciate any insight someone can offer! Thank you!
Assuming the text is entered correctly, and there’ll be no extra spaces/blanks between the two linebreaks you’re using as the paragraph indicators: