Reputation: 1700
I have the following script located at the top of my web page to open a popup window based on the URL parameter I pass it...
<Script Language="JavaScript">
function showDetails(source) {
window.open(source,"","scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,location=no,status=no");
}
</Script>
And I have the following PHP code that calls the function to open the window and passes the url...
$QueryResult = @$this->DBConnect->query($SQLString);
if ($QueryResult !== FALSE) {
if ($QueryResult->num_rows > 0) {
while (($Row = $QueryResult->fetch_assoc())
!== NULL) {
echo "<br /><a href='javascript:showDetails(http://server/~user/PHP/EventDetails.php?PHPSESSID=".session_id()."&EventID=".$Row['EventID'].")'>".
htmlentities($Row['Title'])."</a>";
}
}
echo "</td>";
if ((($FirstDOW + $i) % 7) == 0) {
echo "</tr>";
}
}
When I hover over the link on the web page the URL passed to the function looks fine, and I see something like this at the bottom of the browser, however, when I click the link it does nothing...
javascript:showDetails(http://server/~user/PHP/EventDetails.php?PHPSESSID=Hij3234Abdc732hlae&EventID=2)
Upvotes: 0
Views: 200
Reputation: 143099
You normally put strings in quotes, like
echo "<br /><a href='javascript:showDetails(\"http://server/~user/PHP/EventDetails.php?PHPSESSID="
.session_id()."&EventID=".$Row['EventID']."\")'>".
htmlentities($Row['Title'])."</a>";
Upvotes: 3
Reputation: 1844
Syntax error.
echo "<br /><a href='javascript:showDetails(\"http://server/~user/PHP/EventDetails.php?PHPSESSID=".session_id()."&EventID=".$Row['EventID']."\")'>".htmlentities($Row['Title'])."</a>";
Upvotes: 2