Re: Re: textarea new line
| From: | Ernest E Vogelsinger | Date: | Thu, 23 Jan 2003 12:10:09 +0000 |
| Subject: | Re: Re: textarea new line | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-132802@lists.php.net to get a copy of this message | ||
At 12:55 23.01.2003, Neil M said:
--------------------[snip]--------------------
>Adi wrote:
>> i want to add in textarea a string with new line tag in it. how to do that?
>>
>> my try:
>> $string="-line1n\ -line2 n\-line3";
>> echo "<br><textarea name='aria' cols='50'
>> rows='2'>$string</textarea>";
>>
>> but i see a single line instead of:
>> -line1
>> -line2
>> -line3
--------------------[snip]--------------------
Use nl2br(), something like:
echo '<textarea>', nl2br(htmlentities($string)), '</textarea>';
This should give you the results you need.
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/