Re: [PHP] new lines in textareas?



On Mon, Mar 31, 2008 at 12:40 AM, Paul Scott <pscott@xxxxxxxxx> wrote:


On Sun, 2008-03-30 at 12:29 -0400, tedd wrote:
At 9:26 PM -0700 3/29/08, Mary Anderson wrote:
Hi all,
I have a php script which produces text which is to be displayed
in a textarea. I have the wrap for the text area set to 'hard'. I
need to have newlines inserted in the text.
"\n" and "<br>" don't work. They just get quoted literally in
the text. I suspect I need to use htmlspecialchars , but don't know
what special character to feed it.


Only getting to this now, but doesn't nl2br() do what you want?<http://www.php.net/unsub.php>


well, i don't think nl2br() is a solution here because nl2br() only replace
the '\n' with
<br/> html tags which is displayed inside the textarea. the textarea will
display a new
line with '\n'..

$str = "hello\nworld";
will display

hello
world

in text area. but

$st = 'hello\nworld'.

will be display as

hello\nworld

just like what TG trying to say..


Relevant Pages

  • Re: Display multiple lines
    ... The data is collected in a ASP form "textarea" ... The data is then displayed in an HTML form. ... or line feed characters in the text, ... Data display process: ...
    (microsoft.public.inetserver.asp.general)
  • Re: "style" attribute within "TEXTAREA" tag with large contents
    ... I would ask wether or not there's a specific reason to display the ... information in a <TEXTAREA> if you're not going to be doing anything ... > The page is a kind of log display, and the log output is displayed ... > TEXTAREA tag is the cause of the hang/slowdown. ...
    (microsoft.public.inetsdk.html_authoring)
  • Re: JavaScript on Demand
    ... - The problem is it does not initialize the TXT even though it is ... tinyMCE initializes some functionality, so I see the editor appended ... to my textarea field. ... user can select what content to display. ...
    (comp.lang.javascript)
  • Re: How to display styleed text in a textaea or... ???
    ... But somehow the HTML tags in textarea look messy... ... Since text in 'textarea' can not display HTML effects(maybe I was ... WYSIWYG editor of my own. ...
    (comp.lang.javascript)
  • Re: How to display styleed text in a textaea or... ???
    ... movies) in the same box... ... But somehow the HTML tags in textarea look messy... ... Since text in 'textarea' can not display HTML effects(maybe I was ...
    (comp.lang.javascript)