Re: keep textformating ?
| From: | Justin French | Date: | Mon, 08 Jul 2002 13:38:17 +0000 |
| Subject: | Re: keep textformating ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-106079@lists.php.net to get a copy of this message | ||
The only text formatting you're likely to have in a text field from a html
form is line breaks (\n).
So, to keep the formatting of these breaks, insert the text into the DB as
is, then on pulling it out, convert \n's to <br />'s using nl2br($string),
so that the "newlines" appear within a HTML page.
Justin French
on 08/07/02 11:28 PM, Hawk (hw2k@barrysworld.com) wrote:
> Lets say I have a guestbook, and I want the text the visitors write in it be
> saved in a database(mysql) and when retrieved, if should have the same
> textformating, I guess this is a really basic thing, but I don't know what
> to look for :)
> I've caught \n and ereg*, but I'm not sure that's the thing, help bitte .)
>
> Håkan
>
>