View Full Version : [Solved]Popup and php variable

01-01-2009, 10:41 PM

I searched and found many topics about this, but none that solved my particular problem.

I have a list of results from a database. I would like to add a link to that list that opens a popup with additional info for that particular item.
I know I'm very close, but something's not right

in my header

<script type='text/javascript'>
function InfoPopup(doel) {
window.open(doel, 'myWindow','status = 1, height = 420, width = 450, resizable = 0' )

My script

$query2 = "SELECT a.naam, a.aid, c.aid, c.titel, c.cdvd_id, c.medium_id
FROM artiest a, cd_dvd c
WHERE a.aid = c.aid
AND c.medium_id='$medium_id'
ORDER BY c.cdvd_id DESC
LIMIT 10";

$result2 = mysql_query($query2);
if ( !$result2 ) {
echo "Fout bij ophalen van gegevens...<br>";
} else {
$numrows = mysql_num_rows($result2);
if ( 0 == $numrows ) {
echo "geen CD of DVD te vinden...";
} else {
echo "<table class='tabel'>
<caption>Laatste 10 ingaves</caption>
for ( $i=0; $i < $numrows; $i++ ) {
$naam2 = mysql_result ( $result2, $i, "a.naam");
$titel2 = mysql_result ( $result2, $i, "c.titel");
$cdvd_id = mysql_result ( $result2, $i, "c.cdvd_id");

echo "<tr>
<td><a href='javascript:InfoPopup(infopop.php?cdvd_id=$cdvd_id)' /><img src='../images/external.png' width='10' height='10' border='0' alt=''></a></td></tr>";
echo "</table>";
The mistake is probably in the href part.

Thank you in advance

01-01-2009, 10:48 PM
As i submitted this, I thought: let's try

<a href=# onclick=InfoPopup('infopop.php?cdvd_id=$cdvd_id') /><img src='../images/external.png' width='10' height='10' border='0' alt=''></a>

And it worked :D