dptr1988 Posted June 22, 2006 Share Posted June 22, 2006 I'm making a MySQL query interface in HTML. And I have some JavaScript buttons that will insert the previous queries into the form. But some MySQL querys can contain single and double quotes. Here is the JavaScript code that I am using to insert the previous query:[code]onClick="document.getElementById('the_form').db_query.value='text to insert \'Single quotes work\' but \"double quotes\" do not work'; return false"[/code]I can use single quotes if I replace the single quote with \' But i tried that for double quotes and it doesn't work. How can I insert text that contains single quotes and double quotes into the the 'db_query' textarea?Thanks Quote Link to comment https://forums.phpfreaks.com/topic/12651-how-do-i-escape-single-and-double-quotes/ Share on other sites More sharing options...
dptr1988 Posted June 22, 2006 Author Share Posted June 22, 2006 I found the answer to my question. I needed to replace the double quotes with & quot;. I now know that it was a HTML question, so I apologize for posting it here in the JavaScript Help message board. Quote Link to comment https://forums.phpfreaks.com/topic/12651-how-do-i-escape-single-and-double-quotes/#findComment-48642 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.