php/javascript woes

Lonni J Friedman netllama at gmail.com
Wed Apr 16 16:07:02 PDT 2008


Any php/javascript experts here?  I'm attempting to use javascript for
the first time inside of php, and its going poorly.

I'm working on a project that is primarily written in PHP, and I want
to have a URL which has PHP variables embedded in it appear in an
overlib(js) popup window. I'm currently running into a nasty problem
where the overlib enabled links on the main page fail to work at all,
and in the Firefox Error Console I see:
########
Error: missing ) after argument list
Source File: http://reports/nightly-chart/chart1.php
Line: 1, Column: 43
Source Code:
return overlib('<DIV id="overpop"><A
HREF='http://reports/nightly/index.php?table_name=cudasmoke&function=details&where_field=id&where_value=70752'
target=\'_blank\'>Details</a><BR>Yet another line of text</DIV>',
CAPTION, 'FAILED');
########

The PHP code in question which generates this mess is:
#############
$url1='HREF=\'http://reports/nightly/index.php?table_name='.$table.'&function=details&where_field=id&where_value='.$url0.'\'
' ;
print ("<td style=\"background: url(../newredhash.jpg) repeat;\"\><A
HREF=\"javascript:void(0);\" onclick=\"return overlib('&lt;DIV
id=&quot;overpop&quot;&gt;<A $url1
target=\'_blank\'>Details</a><BR>Yet another line of
text&lt;/DIV&gt;', CAPTION, 'FAILED');\"
onmouseout=\"nd(0);\">$rd</a></td>");
#############

I'm reasonably confident that the problem is with how the assorted
quotes in $url1 are getting escaped, cause if I just hardcode the
contents of $url1 inside of the php print statement (in place of
$url1) it all works perfectly.  Anyone see what I might be doing
wrong?

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
L. Friedman                                    netllama at gmail.com
LlamaLand                       https://netllama.linux-sxs.org



More information about the Linux-users mailing list