Jump to content

How do I escape single and double quotes?


dptr1988

Recommended Posts

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
Link to comment
https://forums.phpfreaks.com/topic/12651-how-do-i-escape-single-and-double-quotes/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.