Re: textarea new line
| From: | PHPCoder | Date: | Fri, 05 Jul 2002 13:17:22 +0000 |
| Subject: | Re: textarea new line | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-105636@lists.php.net to get a copy of this message | ||
Sorry, you DO need nl's, but it's \n not n\
PHPCoder wrote:
When you echo, you are adding to HTML, so you need <br> for new lines not \n. There is a function called nl2br that converts the nl into br's for you, so do this; $string="-line1n\ -line2 n\-line3"; $string = nl2br($string); echo "<br><textarea name='aria' cols='50' rows='2'>$string</textarea>"; 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 tx in advance for any help