dcaplan Posted June 12, 2010 Share Posted June 12, 2010 I am using an ajax/php live search on my site combined with the greybox javascript. The problem I am having is that when trying to call the javascript from my ajax/php live search, i cannot get it to work because it requires a double quote. Here is what I am trying to get it to look like: if ($hint=="") { $hint="<a href='" . $z->item(0)->childNodes->item(0)->nodeValue . "' target='_blank' rel="gb_page_center[640, 480]">" . $y->item(0)->childNodes->item(0)->nodeValue . "</a>"; } But of course, the only way I can not break my search is if I change the double quote to a single and than my 'rel' stops working. Any suggestions? Link to comment https://forums.phpfreaks.com/topic/204566-single-quotedouble-quote-issue/ Share on other sites More sharing options...
kenrbnsn Posted June 12, 2010 Share Posted June 12, 2010 Use the backslash to escape the double quote: <?php if ($hint=="") { $hint="<a href='" . $z->item(0)->childNodes->item(0)->nodeValue . "' target='_blank' rel=\"gb_page_center[640, 480]\">" . $y->item(0)->childNodes->item(0)->nodeValue . "</a>"; } ?> You could also use single quotes in this case: <?php if ($hint=="") { $hint="<a href='" . $z->item(0)->childNodes->item(0)->nodeValue . "' target='_blank' rel='gb_page_center[640, 480]'>" . $y->item(0)->childNodes->item(0)->nodeValue . "</a>"; } ?> Ken Link to comment https://forums.phpfreaks.com/topic/204566-single-quotedouble-quote-issue/#findComment-1071122 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.