"Mehdi Achour" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Patrik Fomin wrote:
> > hi, i have a textbox, after someone puts text into it, it saves into the
> > database,
> > <textarea cols="2" rows="2"></textarea>
> >
> >
> > when it saves to the database the formattion in the textbox dosent work
> > properly,
> > eg:
> > i add this:
> >
> > Test
> >
> > Test
> >
> >
> > Hello
> >
> >
> > and when i retrive the text from the database it looks like this:
> > TestTestHello
> >
> > is there anyway to save (enter formattions)?
> >
>
> echo nl2br($data_from_database); // see php.net/nl2br
>
> Mehdi
Not to be picky but this is considerablly more reliable..
// Convert end of line to <br>..
$str = ereg_replace("\n|\r|\r\n", '<br>', $str);
// Convert <br> to end of line..
Not to be picky but this is considerablly more reliable..
$str = ereg_replace("<br>", "\n", $str);
- Kevin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php