I can't for the life of me figure out how to store this javascript function in a php variable. Basically I want to store this function as a standard string in a php variable, and then it get's printed out on a page. I know that I have to escape javascript to have it work with PHP, but the reason I'm stuck on this is because this particular Javascript and HTML combination seems to make use of both " and ' so I can't figure out how to escape it. Maybe you guys could help me out?
Here's the code I want to store in the php variable:
<a href='javascript:PopupContact_OpenForm("PopupContact_BoxContainer","PopupContact_BoxContainerBody","PopupContact_BoxContainerFooter");'><img src='/popup-contact-form.jpg' /></a>
<div style="display: none;" id="PopupContact_BoxContainer">
<div id="PopupContact_BoxContainerHeader">
<div id="PopupContact_BoxTitle">Contact Us</div>
<div id="PopupContact_BoxClose"><a href="javascript:PopupContact_HideForm('PopupContact_BoxContainer','PopupContact_BoxContainerFooter');">Close</a></div>
</div>
<div id="PopupContact_BoxContainerBody">
<form action="#" name="PopupContact_Form" id="PopupContact_Form">
<div id="PopupContact_BoxAlert"> <span id="PopupContact_alertmessage"></span> </div>
<div id="PopupContact_BoxLabel_Page"> Your Name </div>
<div id="PopupContact_BoxLabel_Page"><input name="PopupContact_name" class="PopupContact_TextBox" type="text" id="PopupContact_name" maxlength="120"></div>
<div id="PopupContact_BoxLabel_Page"> Your Email </div>
<div id="PopupContact_BoxLabel_Page"><input name="PopupContact_email" class="PopupContact_TextBox" type="text" id="PopupContact_email" maxlength="120"></div>
<div id="PopupContact_BoxLabel_Page"> Enter Your Message </div>
<div id="PopupContact_BoxLabel_Page"><textarea name="PopupContact_message" class="PopupContact_TextArea" rows="3" id="PopupContact_message"></textarea></div>
<div id="PopupContact_BoxLabel_Page"><input type="button" name="button" class="PopupContact_Button" value="Submit" onClick="javascript:PopupContact_Submit(this.parentNode,'/popup-contact-form/');"></div>
</form>
</div>
</div>
<div style="display: none;" id="PopupContact_BoxContainerFooter"></div>
Hopefully you can see what I mean, I want to store it in my $button variable
Thanks!