Peter Bushnell
Peter Bushnell

Reputation: 938

Textarea content to td while retaining carriage returns

I have a textarea that gets put into a DB on submission and then pulled into a td element elsewhere.

Pulling it back into a textarea it keep the original formatting. However it should go into a td but that ignores the carriage returns.

How can I get the content from a textarea into a td or perhaps another HTML element other than a form and retain at least the carriage returns?

Upvotes: 0

Views: 73

Answers (2)

caRameL
caRameL

Reputation: 633

Maybe have a look at the nl2br() function.

Upvotes: 1

Explosion Pills
Explosion Pills

Reputation: 191789

Add the white-space: pre or white-space: pre-wrap style properties to the <td>

Upvotes: 0

Related Questions