bbmak Posted March 4, 2017 Share Posted March 4, 2017 Hi Having problem with putting ' in to my link . this is what i want on the link <li><a href="#" onclick="openLink('item.php?merchant_id=x')>Category 1</a></li> this is my mess echo '<li><a href="#" onclick="openLink('''; ?>item.php?merchant_id=<? echo $cat_id . ''')">' . $cat_name . '</a></li>'; & try this echo '<li><a href="#" onclick="openLink('''item.php?merchant_id=' . $cat_id . ''')">' . $cat_name . '</a></li>'; Quote Link to comment https://forums.phpfreaks.com/topic/303349-how-do-i-put-the-in-my-link/ Share on other sites More sharing options...
Solution requinix Posted March 4, 2017 Solution Share Posted March 4, 2017 Use a backslash to escape, not an apostrophe. Quote Link to comment https://forums.phpfreaks.com/topic/303349-how-do-i-put-the-in-my-link/#findComment-1543740 Share on other sites More sharing options...
bbmak Posted March 4, 2017 Author Share Posted March 4, 2017 thanks, got it echo '<li><a href="#" onclick="openLink(\'item.php?merchant_id=' . $cat_id . '\')">' . $cat_name . '</a></li>'; Quote Link to comment https://forums.phpfreaks.com/topic/303349-how-do-i-put-the-in-my-link/#findComment-1543742 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.