Escape JS to build php string
I need to escape certain characters in the following line:
<a onclick="$('#product').submit();" id="add_to_cart" class="button"><span><?php echo $button_add_to_cart; ?></span></a>
so that I can insert them into a php echo,
i.e. $my_string = "<a onclick="$('#product').submit(); etc...etc"
I am usually pretty decent at doing this but I am having some strange results and would really appreciate a fresh pair of eyes on it.