|
Posted by David Mark on 07/26/07 20:34
On Jul 26, 3:20 pm, Randy Webb <HikksNotAtH...@aol.com> wrote:
> Rik said the following on 7/26/2007 1:19 PM:
>
>
>
>
>
> > On Thu, 26 Jul 2007 17:49:41 +0200, Randell D.
> > <fiprojects....@gmail.com> wrote:
>
> >> Folks,
>
> >> I am cross-posting on purpose, even though my problem appears to be
> >> javascript related there might well be a function unknownst to me that
> >> will help resolve the problem before sending to the client...
>
> >> Basically I have a textarea box that is saved from client via php into
> >> my mysql database.
>
> >> When I later try to restore the data I can see it in the HTML source
> >> from my browser (I'm using latest version of Firefox) but an error in
> >> the javascript console tells me the variable is not terminated... This
> >> is because there is a newline character in my text.
>
> >> I've tried addslashes and htmlentities in php but its not worked for
> >> me - can someone advise me of what the solution/workround is?
>
> > $string = str_replace(array("\n","\r"),array('\n','\r'), $string);
>
> Shouldn't that be:
>
> $string = str_replace(array("\n","\r"),array('\\n','\\r'), $string);
Nope.
http://us.php.net/manual/en/language.types.string.php#language.types.string.syntax.single
[Back to original message]
|