Re: Can't get rid of newlines
| From: | Louis Aslett | Date: | Wed, 06 Dec 2000 16:12:54 +0000 |
| Subject: | Re: Can't get rid of newlines | ||
| References: | 1 | Groups: | php.db php.general |
| Request: | Send a blank email to php-general+get-28925@lists.php.net to get a copy of this message | ||
That's it! Well, it wan't actually the solution, but it gave me the right
idea. It seems from plenty of re-attempts that with nl2br(), the <br> is
actually inserted *between* the \n and the \r. This means that I have to do
both, but separately in order to get it to work:
$description=nl2br($description);
$description=str_replace("\n"," ",$description);
$description=str_replace("\r"," ",$description);
This only appears to be an issue because the <textarea> passes \n\r and not
just \n. Must be a Windoze thing?
I think I ought to add a note to the PHP manual about this.
Many thanks for the inspiration,
Louis
----- Original Message -----
From: Michael Rudel <Michael.Rudel@in-gmbh.de>
To: 'Louis Aslett' <laslett@sixnet.net>; Martin A. Marques
<martin@math.unl.edu.ar>
Cc: <php-general@lists.php.net>; <php-db@lists.php.net>
Sent: Wednesday, December 06, 2000 2:48 PM
Subject: [PHP] AW: [PHP-DB] Re: [PHP] Can't get rid of newlines
> Hi Luis,
>
> ... try "\r" instead, or better "\n" AND "\r".
>
> Greetinx,
> Mike
> (Germany)
>
> -----Ursprüngliche Nachricht-----
> Von: Louis Aslett [mailto:laslett@sixnet.net]
> Gesendet: Mittwoch, 6. Dezember 2000 15:43
> An: Martin A. Marques
> Cc: php-general@lists.php.net; php-db@lists.php.net
> Betreff: [PHP-DB] Re: [PHP] Can't get rid of newlines
>
>
> My appologies, that e-mail should have gone:
>
> I'm trying to a some data from a <textarea> form element to an mSQL
> database. However, mSQL coughs shortly after the first newline.
>
> So, I did nl2br() to put all the newlines to <br>'s and then tried the
> following:
>
> $description=str_replace("\n"," ",$description);
>
> to get rid of the newlines. BUT! this string replace did absolutely
> nothing and the newlines are still in there!
>
> WHY?
>
> Thanks
>
> Louis
>
>
> ----- Original Message -----
> From: Martin A. Marques <martin@math.unl.edu.ar>
> To: Louis Aslett <laslett@sixnet.net>
> Cc: <php-general@lists.php.net>; <php-db@lists.php.net>
> Sent: Wednesday, December 06, 2000 2:19 PM
> Subject: Re: [PHP] Can't get rid of newlines
>
>
> > On Wed, 6 Dec 2000, Louis Aslett wrote:
> >
> > > I'm trying to a some data from a <textarea> form element to an mSQL
> > > database. However, mSQL coughs shortly after the first newline.
> > >
> > > So, I did nl2br() to put all the newlines to <br>'s and then tried the
> > > following:
> >
> > What have toy tried?
> >
> > How are the new lines inserted in the textarea? Typing, copy and paste
> > from word?
> >
> > Saludos... ;-)
> >
> >
> > "And I'm happy, because you make me feel good, about me." - Melvin Udall
> > -----------------------------------------------------------------
> > Martín Marqués email: martin@math.unl.edu.ar
> > Santa Fe - Argentina http://math.unl.edu.ar/~martin/
> > Administrador de sistemas en math.unl.edu.ar
> > -----------------------------------------------------------------
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
> >
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>