php - Preserve Line Breaks From TextArea When Writing To MySQL -
i'm using textarea enable users input comments. however, if users enters new lines, new lines don't appear when outputted. there way make line breaks stay.
any idea how preserve line breaks?
two solutions this:
php function
nl2br()
:e.g.,
echo nl2br("this\r\nis\n\ra\nstring\r"); // output this<br /> is<br /> a<br /> string<br />
wrap input in
<pre></pre>
tags.
Comments
Post a Comment