Fadly Dzil
Fadly Dzil

Reputation: 2206

Still get <br> in textarea

I have a text area in html. Then I fill this taxt area like this

Line 1
Line 2
Line 3

But in post, I get like this :

echo $_POST['textarea'] ;

===> Line 1Line 2 Line3

How can I get like this :

Line 1 <br>
Line 2 <br>
Line 3 <br>

Upvotes: 3

Views: 334

Answers (1)

Thamilhan
Thamilhan

Reputation: 13303

Use nl2br — Inserts HTML line breaks before all newlines in a string

echo nl2br($_POST['textarea']);

Upvotes: 13

Related Questions