Re: HTML tags destory formatting?

From: Date: Mon, 23 Jul 2001 12:02:36 +0000
Subject: Re: HTML tags destory formatting?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-10661@lists.php.net to get a copy of this message
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 <gmak@51pct.com> 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?

« previous php.db (#10661) next »