Thanks for the response, but that is exaclty what I am doing. Here's an example:

I input the following into a varchar field:

     This is the first line of text.

     This is the second line of text.

     This is some text with a <a href="link.php">link</a>

     This is the next line.

     This is the last line.

On inserting into the database I tell it to do a nl2br() prior to the insert.

The output from a print() statement is:

     This is the first line of text.

     This is the second line of text.

     This is some text with a <a href="link.php">link</a>
     This is the next line.
     This is the last line.

You see that the formatting is lost after the <a href..> tag.

Any suggestions?

Geoffrey

[EMAIL PROTECTED] wrote:
>
>There are two cases possible:
>1. Store already HTML-formatted text in db. Then you do nothing
>   before sending it to the screen; never use nl2br() here!
>2. Store plain text, may be with a simpliest tags like b, i, u,
>   ol, ul, li, a, img. Then put it through the nl2br() function
>   before outputting to browser.
>   It's easy for the editor that will update news on the site. So she
>   can, for example, copy text from Word document into the form's
>   <textarea> in natural paragraphs, & in browser it will look the
>   same, without need to insert <br> or <p> for paragraph formatting.
>Just select which one is more suitable for u.
>Monday, July 23, 2001, 2:37:15 PM, Geoffrey Makstutis <[EMAIL PROTECTED]> wrote:
>GM> Hi,
>GM> I'm getting a problem when I pull text from a mySQL database. The text is froma
>GM> varchar field and contains some HTML tags. New lines are translated to <BR>, 
but
>GM> when the field is outputted, anything coming after an HTML tag loses its 
formatting
>GM> (ie. no line breaks converted to <BR>).
>GM> Can anyone suggest a solution?
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]

-----
Geoffrey Makstutis
<[EMAIL PROTECTED]>

51% Studios
           Architecture + Design
           1-5 Clerkenwell Road
           London EC1M 5PA

           www.51pct.com

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to