Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Oct 2007
    Posts
    73
    Thanks
    26
    Thanked 0 Times in 0 Posts

    [Solved]Popup and php variable

    Hi,

    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
    Code:
    <script type='text/javascript'>
    		 function InfoPopup(doel) {
                     window.open(doel, 'myWindow','status = 1, height = 420, width = 450, resizable = 0' )
                  }
    </script>
    My script
    PHP Code:
    $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 ( 
    == $numrows ) {
                echo 
    "geen CD of DVD te vinden...";
            } else {
                echo 
    "<table class='tabel'>
                      <caption>Laatste 10 ingaves</caption>
                      </tr>"
    ;
                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>$naam2</td>
                               <td>$titel2</td>
                               <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
    Last edited by friz; 01-01-2009 at 10:47 PM.

  • #2
    New Coder
    Join Date
    Oct 2007
    Posts
    73
    Thanks
    26
    Thanked 0 Times in 0 Posts
    As i submitted this, I thought: let's try
    Code:
    <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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •