Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.