djones Posted January 8, 2008 Share Posted January 8, 2008 The problem is I keep getting "Missing ) after argument list". I know why but I've tried all I can to prevent this from happening. The problem var, descr, is a description that could be "Bob's $50 ticket". I know how to escape the 's but I'm not sure how to clear the rest... button_id is a variable $(button_id).innerHTML = '<a href="#" onclick="add_cart(\''+gift_item_id+'\',\''+descr+'\',\''+amount+'\',\''+button_id+'\');"><img src="/images/add_cart.jpg" border="0" style="margin: 4px 0 0 0" /></a>'; Link to comment https://forums.phpfreaks.com/topic/84961-need-help-escaping-string-with-dynamic-variable/ Share on other sites More sharing options...
fenway Posted January 8, 2008 Share Posted January 8, 2008 You'll have to write a function that knows what's needs escaping... Link to comment https://forums.phpfreaks.com/topic/84961-need-help-escaping-string-with-dynamic-variable/#findComment-433595 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.