PHP replace crlf in a textarea with br
by RedCoupe on Sep.09, 2010, under Web design / development
I had a textarea value which was obtained from a MySQL database and it contained many instances of crlf or \n. To display correctly on a web page I wanted to convert those to <br /> so I used the following code:
<?php echo nl2br($myrecorsetvalue); ?>
Obviously you would need to replace the $myrecorsetvalue with whatever recordset variable you are using.