Re: Text Area Question
| From: | Torsten Roehr | Date: | Wed, 28 Apr 2004 08:03:52 +0000 |
| Subject: | Re: Text Area Question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-184835@lists.php.net to get a copy of this message | ||
"Conbud" <conbudd@yahoo.com> wrote in message
news:20040428075016.84993.qmail@pb1.pair.com...
> Hi, I have a form with a text area, what I would like to do is What ever
> text the user types into the textarea will be entered into a database with
> the same formatting they used when typing in the data. For exampe:
>
> Hello
>
> PHP
>
> World
>
> If they type it so that it looks exactly like that, I want it to post that
> same way on the webpage when it gets the info from the database. I thought
> that if they type that way and the info saves into a blob record it would
> save the breaks, but when i go to get the info to display on the webpage
its
> just one really long line, I tried using <pre> but it was still one line.
I
> notcided that if I didnt let the text wrap on its own in the textarea it
> looked the way I wanted, but to keep it from wrapping you had to enter
> before the text started wrap. The area needs to be no more than 150
> characters wide, so I was wandering if there is a way to make it insert a
> break before the text wraps, so that the user wont have to hit enter
> everytime before the text starts to wrap.
>
> Sorry for such the long question, this was kinda hard for me to explain,
but
> I really appreciate it.
You have to convert the linebreaks into HTML <br> tags for output:
echo nl2br($myText);
Regards, Torsten