Solved

escaping single quote in php generated javascript

Posted on 2007-11-16
4
3,277 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
issue with DB import 1 36
How to use 2 ON statements in inner join 3 20
A responsive image gallery using flexbox 6 12
JSON decode 5 14
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
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 count occurrences of each item in an array.

713 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