Adding single quote to javascript/php block

Discussion in 'Javascript' started by Rich, Feb 26, 2004.

  1. Rich

    Rich Guest

    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>
     
    Rich, Feb 26, 2004
    #1
    1. Advertising

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

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

    Stu

    "Rich" <> wrote in message
    news:...
    > 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>
     
    Stuart Palmer, Feb 26, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    13,249
  2. Eric Layman
    Replies:
    3
    Views:
    631
    Rad [Visual C# MVP]
    Apr 14, 2007
  3. Evan
    Replies:
    1
    Views:
    392
    Marc 'BlackJack' Rintsch
    Nov 4, 2008
  4. Evan
    Replies:
    3
    Views:
    522
    Marc 'BlackJack' Rintsch
    Nov 4, 2008
  5. vikrant
    Replies:
    8
    Views:
    366
    vikrant
    May 17, 2007
Loading...

Share This Page