galvin Posted November 9, 2012 Share Posted November 9, 2012 I have code where info I save to echo later is all within double quotes. So for any other quotes inside the double quotes, I use single quotes. But I am running into trouble when I have even more nested single quotes inside single quotes. Here is the code and it's not working because the single quotes around ARE YOUR SURE are nested within the single quotes for onclick. If I change either set to double quotes, it obviously doesn't work. So what is the proper way to handle this? $codetoecholater = "<a href='something.php' onclick='return confirm('Are you sure?')'>Delete</a>"; Quote Link to comment https://forums.phpfreaks.com/topic/270516-apostrophe-confusion/ Share on other sites More sharing options...
MDCode Posted November 9, 2012 Share Posted November 9, 2012 You need to escape it, this should work. $codetoecholater = "<a href='something.php' onclick='return confirm(\"Are you sure?\")'>Delete</a>"; Quote Link to comment https://forums.phpfreaks.com/topic/270516-apostrophe-confusion/#findComment-1391367 Share on other sites More sharing options...
galvin Posted November 9, 2012 Author Share Posted November 9, 2012 Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/270516-apostrophe-confusion/#findComment-1391368 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.