RE: [PHP] FORM text formatting problem
| From: | John W. Holmes | Date: | Tue, 31 Dec 2002 05:49:57 +0000 |
| Subject: | RE: [PHP] FORM text formatting problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-129739@lists.php.net to get a copy of this message | ||
> When i retrieve the text i have on my database, which was taken
from
> a
> form textbox, i have line breaks ate the end of each line in the
textbox.
> Ah, hard to explain!
> My textbox is small, and everytime, while writing a text in it,
the
> line
> ends and we continued writing on the next one, thats the formatting my
> text
> on the database gets. It doesnt recognize the line breaks we want (by
> pressing ENTER), but takes line breaks simply from reaching the end of
the
> textbox. How can that be?
>
> Before i insert the text from the textbox into the database, i
do
> this:
>
> $texto = str_replace("\r\n", "\n", $texto);
> $texto = str_replace("\r", "\n", $texto);
>
> And when i want to retrieve the text from the database to
display it
> on
> the site, i do:
>
> $texto = str_replace("\n", "<br>", $texto);
Are you using a WRAP attribute on your TEXTAREA? You'll want to set it
to OFF or NONE, probably. I can't remember the exact values, it can
take, but I think it's PHYSICAL, VIRTUAL, and NONE/OFF.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/