Laravel 4.2 br tags to nl in textarea makes double tags

275 Views Asked by At

so i have this problem with Laravel 4.2, that i have a textarea for updating the user profiles "about me", if i take it down from the database it works fine, i tried to do nl2br and hide the br tags, sort of worked aswell, problem is, when i write from scratch and make text like:

"hello

welcome to my profile"

it looks fine on the page it's extracted to, however, if i enter my profile editing page again, it will display with twice the space as such:

"hello



welcome to my profile"

i'm not exactly sure how to fix this, but hoping someone else may know.

my laravel code for extracting it at the moment is this:

{{ Form::textarea('about_me', $user->about_me = str_replace("<br />", "\n", $user->about_me), array('class' => 'profile-input')) }}

thanks for the help in advance :)

1

There are 1 best solutions below

4
On BEST ANSWER

Try this,

{{ Form::textarea('about_me', nl2br(e($user->about_me)), array('class' => 'profile-input')) }}

Hope it help.