0

I am converting <br/> into new line by following this question's answer.

I am using

<textarea name="newtext" style="margin: 0px; width: 550px; height: 120px;"><?php echo str_replace("<br />", "\r\n", $posttext['text']); ?></textarea>

for me. My code is for a edittext field.

My problem is when I am editing text like

hi I am here

It is showing

hi

I am

here

And when I re-editing this it comes like

hi



I am



here

What I need to do to solve this? Here one thing to mention that when I am saving this text I am using

$texttrim = trim($_POST['newtext']);
$newtexts = nl2br($texttrim);
Community
  • 1
  • 1
Sudarshan
  • 938
  • 14
  • 27
  • Did you tryied to remove `\r` ? I already used something similar to add some line-breaks in a `` and the use of these both was a problem since it added one more line-breaks. – Anwar Aug 07 '15 at 09:01
  • First I tried without \r. But result was same, – Sudarshan Aug 07 '15 at 09:21

0 Answers0