Help with writing JavaScript to a txt with PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Henaro
Forum Newbie
Posts: 4
Joined: Sun Nov 12, 2006 5:01 pm

Help with writing JavaScript to a txt with PHP

Post 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
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Post by jayshields »

Use the escape character, which is \.

Code: Select all

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