# Using nl2br in PHP

**URL:** https://forum.kirupa.com/t/using-nl2br-in-php/85360
**Category:** programming
**Created:** [April 4, 2005, 4:59am UTC](https://forum.kirupa.com/t/using-nl2br-in-php/85360 "2005-04-04T04:59:40Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![sky131](https://avatars.discourse-cdn.com/v4/letter/s/ec9cab/32.png) [@sky131](https://forum.kirupa.com/u/sky131)
#### Post date: [April 4, 2005, 4:59am UTC](https://forum.kirupa.com/t/using-nl2br-in-php/85360/1 "2005-04-04T04:59:40Z")

</div>

I had been using nl2br to post a textarea to a MySQL database. When I view the post on a page all is well (ie - the \<br\> tags have been added).

What I want to do now is echo that info back into a textarea for editing, but have it remove the \<br\> tags and keep the line breaks. Right now it echoes in the \<br\> tags and the line breaks so when I repost to the database the lines get doubled. The cure right now is to manually delete all the \<br\> tags.

Is there a better way to echo the info to the textarea and strip the \<br\> tags?

Thanks.
