Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3290
  • Last Modified:

escaping single quote in php generated javascript

hello,

i need to escape the single quotes in my javascript output

right here
href='javascript:StartWindow('

that quote at the end and of course the closing quote

')'>

 

print "<td width='200' valign='top'>
<table width='200' border='0' cellspacing='5' cellpadding='0' class='text'>
          <tr align='left' valign='top'>
              <td width='200'><a href='javascript:StartWindow('popup.php?id=" .  $row['press_id'] . "')'><img src='uploads/" . $row['press_small'] . "' width='141' class='image_display_list' border='0'><br><br>" .  $row['press_display_name'] . "<br>" .  $row['press_display_date'] . "</a><br><br></td>
          </tr>
             
            </table>
                  </td>";
0
jblayney
Asked:
jblayney
  • 2
  • 2
1 Solution
 
nplibCommented:
\'

thats how you escape a quote,

you may have to escape the escape character

\\'

0
 
jblayneyAuthor Commented:
hello,

thanks for the feedback, but i actually already tried both of those before i posted this, neither work
0
 
nplibCommented:
define not work.
0
 
jblayneyAuthor Commented:
well, when i hover over the link with my mouse, the url reads startWindow('


i found a solution,. i switched it to a double quote and it works

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now