Date: 08/31/99
- Next message: christopher wright: "Re: [PHP3] Uploaded files stored in Database or Filesystem?"
- Previous message: christopher wright: "[PHP3] \n's et al"
- In reply to: christopher wright: "[PHP3] \n's et al"
- Next in thread: Richard Lynch: "Re: [PHP3] \n's et al"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
At 10:00 31-8-99 +0100, christopher wright wrote:
>Hi
>
>I have a text string being placed into a mysql field from a textarea form,
>hence it contains all manner of newlines and other nasties.
>
>I want to take that string and replace any kind of newline with a \n so that
>I can end up with one long line of text suitable to stick into a javascript
>variable without getting unterminated string constant errors.
>
>So far I've tried just about everything I can think of with eregi_replace's,
>nl2br followed by eregi's on the BR produced etc, but nothing seems to be
>able to detect two newlines - i.e. a line of whitespace. Why won't this
>code produce me one long line of characters with \n instead of actual line
>breaks for example:
>
>$nq=nl2br($foo); // foo is my string...
>$nq=eregi_replace("<br>","\\n",$nq);
>
Dirty but works :
$nq = implode("//n", explode("/n", $nq));
of
$nq = implode("<BR>", explode("/n", $nq));
i think this is what you mean... else redifine :)
have a nice day
wico
- Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe trying to
produce bigger and better idiots. So far, the Universe is winning.
- Practice makes perfect, but if nobody's perfect, why practice?
Wico de Leeuw "Melt_Down", (wico <email protected>) ICQ - 33093128
(Web) Programmer / System Administrator
-- PHP 3 Mailing List <http://www.php.net/> To unsubscribe, send an empty message to php3-unsubscribe <email protected> To subscribe to the digest, e-mail: php3-digest-subscribe <email protected> To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: christopher wright: "Re: [PHP3] Uploaded files stored in Database or Filesystem?"
- Previous message: christopher wright: "[PHP3] \n's et al"
- In reply to: christopher wright: "[PHP3] \n's et al"
- Next in thread: Richard Lynch: "Re: [PHP3] \n's et al"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

