Re: Line Breaks in a Textarea



Geoff Berrow wrote:
Message-ID: <e2u3ak$8om$1@xxxxxxxxxxxxxxxxxxxxxxx> from Rik contained
the following:

Else: don't use nl2br() while displaying it in a textarea.

AFAIK nl2br() adds a <br /> *** doesn't remove the \n

Yup, but in shows "<br />" in the textarea, so you get line-breaks, and on
every end a useless <br />.
Which would you prefer:
<?php
$string="aksfdjal\nsgfhsflijslfj\nsdihflsjfldsf";
?>
<textarea><?php echo nl2br($string); ?></textarea>
<textarea><?php echo $string; ?></textarea>

Grtz,
--
Rik Wasmus


.


Quantcast