Re: new lines in textareas?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Mar 30, 2008 at 2:07 PM, TG <tg-php@xxxxxxxxxxxxxxxxxxxxxx> wrote:

>
> Is \n included literally because you're using single quotes for the
> variable?
>
> $textdata = 'This is a test\nThis is the second line';
>
> vs...
>
> $textarea = "This is a test\nThis is the second line";
>
> I would guess a lot of the pages you find are talking about what to do
> with
> the text after submitting through the textarea, not re-displaying with
> proper breaks when loading a page containing a text area that should have
> data.
>
> -TG
>
> ----- Original Message -----
> From: Mary Anderson <maryfran@xxxxxxxxxxxxxxxxxx>
> To: php-general@xxxxxxxxxxxxx
> Date: Sat, 29 Mar 2008 21:26:24 -0700
> Subject:  new lines in textareas?
>
> > 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.
> >
> >      Apologies if this should go to an HTML forum.  I checked several
> > archives and did not find anything useful.  (They tended to tell me to
> > put in \n or <br>!)
> >
> >      Thanks
> >
> > Mary Anderson
>

my client ask me about this problem 2 weeks ago. he want the text to
automatically
go to new line after user type until the end of the line. The only possible
solutions so
far is using wrap='hard' or wrap='soft'
eg: <textarea cols=10 rows=10 wrap=hard>
but wrap only work on IE & Netscape browser. Not working in firefox.
i guess i want to use javascript to do the text formatting. trigger the
javascript event
every time the user using the onchange event (i never try)..
i is quite complicated & i dont have much time working on it.
so i decided to tell him, it cannot be done :)

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux