You are here: Re: Line Breaks in a Textarea « PHP Programming Language « IT news, forums, messages
Re: Line Breaks in a Textarea

Posted by Rik on 04/29/06 01:52

Geoff Berrow wrote:
> Message-ID: <e2u3ak$8om$1@netlx020.civ.utwente.nl> from Rik contained
> the following:
>
>> Else: don't use nl2br() while displaying it in a textarea.
>
> AFAIK nl2br() adds a <br /> butt 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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация