Re: Form TextArea Formatting
| From: | Alex Francis | Date: | Mon, 09 Dec 2002 12:43:15 +0000 |
| Subject: | Re: Form TextArea Formatting | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-23929@lists.php.net to get a copy of this message | ||
You would be easier reformatting when you take it out of the database. After
getting your variable representing the text in the text box do this:
$variable = nl2br($variable);
Then when you display your variable the all your original new lines are
retrieved.
"John W. Holmes" <holmes072000@charter.net> wrote in message
news:000301c29f7a$de69b010$7c02a8c0@coconut...
> > I've created a web form that includes a textarea input box called
> > MessageText. The data from this form will be inserted into a mysql
> table.
> > My problem is that the form users will be inserting formatted text
> into
> > this
> > textarea and I need to be able to transfer the formatting as well as
> the
> > content into the database. Right now, all formatting is lost in the
> > transfer. Any ideas or suggestions?
>
> If you're talking about spaces and tabs and newlines, the formatting
> isn't lost. It just that HTML doesn't render tabs or newlines or more
> than one space. You need to convert your plain text to HTML so it
> renders correctly. Newlines are <br>, spaces are , etc...
>
> These URLs may help:
>
> www.php.net/nl2br
> www.php.net/htmlentities
>
> ---John W. Holmes...
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
>
>
>