Multiple operators

Hi below is my code. I need to add " in the onclick area instead of '. how can I add " if the code already has open ".

$showpin = "<div class='contentmboardbutton3' onClick='document.location.href = 'messageboard.php?act=pin&msgid=$msgid'';>PIN</div>";
onClick='document.location.href = \\"messageboard.php?act=pin&msgid={$msgid}\\"'

You need to escape the double quotes by using the backslash.

Also, I put curly braces around your variable there. This isn’t necessary in this example but is a good practice.