How would I add line breaks to a text area after it is submitted like this:
Text
Text2
Text3
would be
Text<br>
<br>
Text2<br>
Text3<br>
Adding line breaks to text
Moderator: General Moderators
Use nl2br
Unless I'm missing something, you could use nl2br like so:
Code: Select all
<?php
$string = "Text\nText2\nText3\n";
echo nl2br($string);
?>
And if you have more sophisticated needs it would be pretty easy to write a function that uses nl2br. Hope this helps.