By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,401 Members | 1,381 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,401 IT Pros & Developers. It's quick & easy.

Adding single quote to javascript/php block

P: n/a
I have a block of code that calls a function to copy some text to the
clipboard. The text includes some text and an email from a recordset.
I am trying to put the email address inside a single quote however
any PHP or javascript methods that I try to use causes the function
not to work. If I want to add a single quote should I put it inside
the php echo or in between? and if so how should I format?
<span onclick='return copy_clip("<?php echo 'The payers email is ';
?><?php echo $row_rsPayments['payer_email']; ?>")'>Click Here</span>
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Rich,
Here is the code you want your PHP to output:
<span onclick="alert('The payers email is \'b***@blah.com\'');">Click
Here</span>

the \' cancels out the special meaning of the ' so just displays ' instead.

Stu

"Rich" <td*******@yahoo.com> wrote in message
news:22**************************@posting.google.c om...
I have a block of code that calls a function to copy some text to the
clipboard. The text includes some text and an email from a recordset.
I am trying to put the email address inside a single quote however
any PHP or javascript methods that I try to use causes the function
not to work. If I want to add a single quote should I put it inside
the php echo or in between? and if so how should I format?
<span onclick='return copy_clip("<?php echo 'The payers email is ';
?><?php echo $row_rsPayments['payer_email']; ?>")'>Click Here</span>

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.