I am entering text into a textarea field and pressing the return key to force a new line. But when the contents of the textarea field is displayed I am seeing the new line html tag <br /> symbol (see below). How do I stop these symbols from displaying and still force a new line?

line one<br />
line two<br />
line three

The HTML code looks like this:

<tr class=bodyTRstyle><td class=labelTDstyle width="469" align="left"><font size="2">Comments</font></td>
<td class=fieldTDstyle width="469">
<textarea name="Comments" class=Comments rows="5" cols="20"><?php echo $Comments?></textarea></td></tr>

thank you in advance for your help.

Recommended Answers

All 2 Replies

It sounds like your content stored in the $comments var might have had html_entities() applied to it. in this case your text string actually looks like &gt;br /&lt; which when displayed in a browser would show as <br />

Check for an html_entities function upon storing the data. If you cannot change it on the storing you could do a search and replace on $comments before displaying it.

Just realize I might have miss understood. Instead just do a search and replace. look for <br /> and replace it with \n

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.