Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

escaping single quote in php generated javascript

Posted on 2007-11-16
4
3,276 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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
How do I fix this UPDATE error? 7 32
Help with PHP 13 27
Delete  php pages of a part of our site 8 31
issue with DB import 1 17
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…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
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.

809 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