Re: textarea new line
| From: | Richard Lynch | Date: | Sat, 06 Jul 2002 05:27:12 +0000 |
| Subject: | Re: textarea new line | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-105828@lists.php.net to get a copy of this message | ||
>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
>
>tx in advance for any help
In addition to using \n instead of n\, you also should do:
echo "<br><textarea name='aria' cols='50'
rows='2'>", htmlentities($string),
"</textarea>";
This will fix any problems with quotes, apostrophes, HTML, etc buried in
$string.
--
Like Music? http://l-i-e.com/artists.htm