Solved

escaping single quote in php generated javascript

Posted on 2007-11-16
4
3,264 Views
Last Modified: 2013-12-12
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
Comment
Question by:jblayney
  • 2
  • 2
4 Comments
 
LVL 17

Expert Comment

by:nplib
Comment Utility
\'

thats how you escape a quote,

you may have to escape the escape character

\\'

0
 
LVL 1

Author Comment

by:jblayney
Comment Utility
hello,

thanks for the feedback, but i actually already tried both of those before i posted this, neither work
0
 
LVL 17

Expert Comment

by:nplib
Comment Utility
define not work.
0
 
LVL 1

Accepted Solution

by:
jblayney earned 0 total points
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now