I use this function to cleanup my text.
It converts any weird characters that may cause problems when outputting to 
html with php.
It also converts end of line to <br> or <br /> depending on your version of 
php

function cleanup($copy) 
{ 
    $copy=trim($copy); 
    $copy=htmlspecialchars($copy, ENT_QUOTES); 
    $copy=eregi_replace ("%", "&#37;", $copy);  
    $copy=eregi_replace ("<", "&lt;", $copy); 
    $copy=eregi_replace (">", "&gt;", $copy);  
    $copy=eregi_replace ("&amp;", "&", $copy); 
    $copy=nl2br($copy); 
    $copy=StripSlashes($copy); 
    return($copy); 
} 


On Wednesday 24 October 2001 02:04 am, Steve Meyers wrote:
> Are you sure it doesn't have the line feeds in the database?  Neither MySQL
> nor PHP will strip them out, unless you do some fancy work to make it do
> that.  I would guess that your real problem is that when you display it in
> your HTML, it shows up without "returns".  This is standard HTML practice
> -- try running the PHP function nl2br() on the data before displaying it.
>
> Steve Meyers
>
> > -----Original Message-----
> > From: tim gales [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, October 23, 2001 9:31 PM
> > To: [EMAIL PROTECTED]
> > Subject: Formatting Large amounts of Text into Mysql
> >
> >
> > Hi.  I am trying to have type in a story into a form "textfield" and
> > submit it using PHP into "blob" formatted field mysql database.
> >
> > When I submit, all the "returns" are removed and all the text runs
> > together like on ebig paragraph.  Is there a way to have mysql or PHP
> > recognize the "returns" and "empty lines" from the "textarea" field and
> > rememeber them so when I call them up from the database the formatting
> > looks just like when I typed it in the text field?
> >
> > Any help would be very much appreciated.Thank you
> > Tim Gales
> >
> >
> > ---------------------------------------------------------------------
> > Before posting, please check:
> >    http://www.mysql.com/manual.php   (the manual)
> >    http://lists.mysql.com/           (the list archive)
> >
> > To request this thread, e-mail <[EMAIL PROTECTED]>
> > To unsubscribe, e-mail
> > <[EMAIL PROTECTED]>
> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to