Click to See Complete Forum and Search --> : help with sorting out quotes in expression


strBean
01-10-2006, 11:03 AM
This works:
<a href="#" onclick="window.open('supporters_list.php','_blank','height=400, left=100, location=no, menubar=no, resizable=no, scrollbars=yes, status=no, titlebar=no, toolbar=no, top=150, width=850')" alt="link to Supporters list">review Supporters list</a><br><br>


This doesn't work:
<?php
print '<td>'.$row[4].'</td><td>'.$row[5].'</td><td>'.$row[6].'</td><td><a href="#" onclick="window.open("supporter_interests.php?supporter='.$row[0].'","_blank","height=250, left=100, location=no, menubar=no, resizable=no, scrollbars=yes, status=no, titlebar=no, toolbar=no, top=150, width=450")">Interests</a></td></tr>';
?>

The trouble comes, of course, with needing concatenate a variable into the javascript argument string. I'm sure there has to be a way to do it, but nothing I've tried works. Any help will be greatly appreciated.

chickenland
01-10-2006, 11:09 AM
<?php
print '<td>'.$row[4].'</td><td>'.$row[5].'</td><td>'.$row[6].'</td>';
?>
<td><a href="#" onclick='window.open("supporter_interests.php?supporter=<?php echo $row[0]; ?>","_blank","height=250, left=100, location=no, menubar=no, resizable=no, scrollbars=yes, status=no, titlebar=no, toolbar=no, top=150, width=450")'>Interests</a></td></tr>';
<?php
?>

strBean
01-10-2006, 11:22 AM
Gee, that looked promising.

I'm getting this error:

Parse error: parse error, unexpected '\"' in /usr/www/users/washing3/private/supporters_list.php on line 48

Line 48 is the line you tweaked for me. There's no backslash anywhere in the line, nor in the value of the variable. There's nothing missing on the previous line, either.
Hmmm.

NogDog
01-10-2006, 11:33 AM
<?php
print <<<EOD
<td>{$row[4]}</td><td>{$row[5]}</td><td>{$row[6]}</td><td>
<a href="#" onclick="window.open('supporter_interests.php?supporter={$row[0]}','_blank','height=250, left=100, location=no, menubar=no, resizable=no, scrollbars=yes, status=no, titlebar=no, toolbar=no, top=150, width=450')">Interests</a></td></tr>
EOD;

?>

strBean
01-11-2006, 02:39 PM
Thanks, NogDog. I didn't get an email this time, so I didn't know you'd posted. In the meantime, I replaced the javascript inside that print stmt and put it in a js function, which solved my quotes mixup for me.

When I saw your code, I decided to try it. I still got an error that I didn't understand, like I'd forgotten a closing brace somewhere, but I sure couldn't find it.

Thanks again.