Date: 08/31/99
- Next message: schlicht <email protected>: "Re: Re: [PHP3] Something like "isNull" in PHP3???"
- Previous message: Sam Turner: "[PHP3] Quick Question"
- In reply to: christopher wright: "[PHP3] \n's et al"
- Next in thread: christopher wright: "Re: [PHP3] \n's et al"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
http://www.php.net/manual/function.addslashes.php3
You also should research the "magic_quotes" setting in php3.ini et al.
At 10:00 AM 8/31/99 +0100, you 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);
>
>I tried eregi_replace("\n","\\n",$foo) too - same thing. Lines terminating
>in a single newline are escaped no problem, but a blank line ain't
>happening. Is there a function to return the character code of a string in
>PHP so I can just run through and check exactly what controls are in there?
>
>Any advice would be most appreciated.
>
>Christopher
>Wonderstore Developments Ltd
>T.F. +44 171 6811870
>www.wonderstore.com
>creators of www.sometimefriday.com
>
>
>--
>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>
>
-- "TANSTAAFL" Websites I have built: CHaTMusic.com EmphasisEntertainment.com L-I-E.com JadeMaze.com CatCatalani.com MGMH.com AstraKelly.com OlivierLedoux.com-- 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: schlicht <email protected>: "Re: Re: [PHP3] Something like "isNull" in PHP3???"
- Previous message: Sam Turner: "[PHP3] Quick Question"
- In reply to: christopher wright: "[PHP3] \n's et al"
- Next in thread: christopher wright: "Re: [PHP3] \n's et al"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

