Re: php/html displaying query
| From: | David Robley | Date: | Fri, 19 Nov 2004 03:01:42 +0000 |
| Subject: | Re: php/html displaying query | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-202479@lists.php.net to get a copy of this message | ||
On Fri, 19 Nov 2004 00:44, Angelo Zanetti wrote:
> HI all,
>
> I have this situation & think that maybe some of you could advise me on
> a solution.
>
> I have a field in my database which is about a few paragraphs long.
> When the user edits this paragraph using php/html in a textarea it
> displays correctly with the lines that separate the paragraphs. These
> lines are merely blank lines.
>
> However when I want to display this field in HTML I have a problem that
> its all bunched into 1 paragraph, obviously because there are no <p> or
> <br> tags telling the browser there is a space in between, 1 way to get
> this to work is to to insert <p> or <br> statements in the paragraph but
> when the user then edits the paragraph in the textarea it will show the
> <p> or <br> tags which i dont want, they are end users and will probably
> delete them. Is there a way to get around this?? either displaying the
> blank line or by hiding the HTML tags in the textarea (but still saving
> the paragraph with them in)
Use nl2br() when you display the data; nl2br will add a <BR /> before each
newline.
--
David Robley
"I hope I can still play the guitar," Tom fretted.