Page 1 of 1

Help with writing JavaScript to a txt with PHP

Posted: Sun Nov 12, 2006 5:08 pm
by Henaro
Hey everyone!

I am trying to get my java script ot be written to a text file in PHP. Here is the code:

Code: Select all

$quote = "<p onClick="sendText(document.lolform.posting, '<a href=$random>$username</a> said: <Br>$post')">[QUOTE]</p>";
Which is later put into fwrite. The only problem is, is that with the java script you need the double quotes for onClick and that conflicts with my variable declatartion in PHP and gives me a parse error. I was wondering if there was a way around this.

Thanks,
Henaro

Posted: Sun Nov 12, 2006 5:10 pm
by jayshields
Use the escape character, which is \.

Code: Select all

$str = "This is what John said: \"HI!\". Isn't that nice.";