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.

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

5 Years
Discussion Span
Last Post by ajbest

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.