Adding single quote to javascript/php block

R

Rich

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>
 
S

Stuart Palmer

Rich,
Here is the code you want your PHP to output:
<span onclick="alert('The payers email is \'(e-mail address removed)\'');">Click
Here</span>

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

Stu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top