Solved

escaping single quote in php generated javascript

Posted on 2007-11-16
4
3,272 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
ID: 20301334
\'

thats how you escape a quote,

you may have to escape the escape character

\\'

0
 
LVL 1

Author Comment

by:jblayney
ID: 20301356
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
ID: 20301368
define not work.
0
 
LVL 1

Accepted Solution

by:
jblayney earned 0 total points
ID: 20301396
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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 …

810 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