I'm a newbie so don't laugh...

I'm trying to create a page that displays links to a video log (vlog). The videos are all stored on YouTube. I have a MySQL database that contains the iFrame data to display the video from YouTube.

On my page, I have a list of available videos. This list is populated from the MySQL database using PHP. At the end of each line is a link. I want the link to open a new window, sized to match the display characteristics of the video. Here is the code for the link. This code appears inside my PHP tags.

<a href = \"#\" onClick=\"window.open('http://some_site.com','window_name','left=20,top=20,toolbar=no,location=no,menubar=no,scrollbars=no,resizable=no,width=800,height=600,left=100,top=100');\"><img src=\"arrow.gif\"></a>";

This code displays an arrow that when clicked opens a window from some_site.com. It works just fine. I have been trying to figure out where to insert the iFrame code. Nothing seems to work.

Any ideas?

    What you have there is just Javascript code attached to an empty link that is opening the new window. You can tag some extra code onto the end of the onclick handler to write the iframe to that window or change the 'http://some_site.com' to point to a PHP script on your server that contains the iframe code.

    Basically, your link would change to something like [url]http://some_site.com/video.php?clip_id=1234[/url] and your video.php script could look like this:

    <html>
    <head><title>Video</title></head>
    <body>
    <?php
    $clip_id = intval($_REQUEST['clip_id']);
    $query = "SELECT iframe_code FROM table WHERE clip_id=$clip_id";
    $result = mysql_query($query);
    
    if(mysql_num_rows($result))
    {
        $data = mysql_fetch_array($result);
        echo $data['iframe_code'];
    }
    ?>
    </body></html>
    

      Thank you for the reply. I added a PHP script on the server that handles the iFrame code. It works just fine. Thanks again.

        Thanks for the help. How do I mark this thread as Resolved?

          I believe there's an option under the thread tools, whereever that is!

            Write a Reply...