-1

The problem is that the value from textarea, instead of getting it to next line, it is not working when I used it as at view.

I have this value from a textarea

TESTING:TESTING
ANOTHER THING:ANOTHER THING

But the value in viewing end up like this:

TESTING:TESTING ANOTHER THING:ANOTHER THING

Using php I will get the value.

<div>Content</div>
<p><?= $data->content; ?></p>

In database the value is same as what I inputted on the textarea only the viewing part has a problem. But using it as a textrea tends to work.

I wanted the result to be the same as what I input on the textarea on the p tag.

Zain Farooq
  • 2,956
  • 3
  • 20
  • 42
glen
  • 3
  • 1
  • 7

1 Answers1

0

Use this

$string=str_replace(PHP_EOL,"<br>",$_POST["string"]);
echo $string;

It will trace and replace php end of line with br tag

Zain Farooq
  • 2,956
  • 3
  • 20
  • 42