question about opening a new window, not what you think.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
justAnoob
Forum Newbie
Posts: 2
Joined: Mon Feb 08, 2010 10:14 pm

question about opening a new window, not what you think.

Post by justAnoob »

I'm looking to have a link called 'watch'
when you click the link, a new page would open displaying a video
the video is actaully a row in the database $row['video_loc']
i have the script to display the video on the same page right now. I would love for the video to open in a new window. I have been struggling for days now. Can anyone help me out? oh yeh, the new window is named showvideo.php.... Here is what I have come up with, but no luck yet

Code: Select all

 
echo '<a href="{Watch}"onClick="window.open("showvideo.php?loc={$row["video_loc"]}","window_name","width=900");return false\">$row["video_loc"]</a>';
 
justAnoob
Forum Newbie
Posts: 2
Joined: Mon Feb 08, 2010 10:14 pm

Re: question about opening a new window, not what you think.

Post by justAnoob »

Here is a small part of the script, but the important part

Code: Select all

 
echo '<span class="names">Posted on:</span><br>';
echo 'posted on';
echo '</td></tr></table></td><td width="425">';
$clicky = $row['video_loc'];
?>
<a href="showvideo.php?take_over="<?php echo $clicky; ?> target="_blank">Watch</a>
<?php
echo '</td></tr></table></td></tr>';
    
}
echo "</table>";
 
With this, It is displaying the video and the the watch link.
I forgot to mention that the record in the db, $row['video_loc'] is actually the embed code from a youtube video.
For some reason I can't get $clicky to pass through the url so it will display on a new window.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: question about opening a new window, not what you think.

Post by social_experiment »

Could you please paste the code that you use to get :

Code: Select all

<?php $clicky = $row['video_loc']; ?>
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
a.heresey
Forum Commoner
Posts: 59
Joined: Wed Dec 13, 2006 7:31 pm
Location: Chesapeake, VA, US

Re: question about opening a new window, not what you think.

Post by a.heresey »

You are closing the href attribute before you echo the url

Code: Select all

<a href="showvideo.php?take_over="<?php echo $clicky; ?> target="_blank">Watch</a>
should be this

Code: Select all

# <a href="showvideo.php?take_over=<?php echo $clicky; ?>" target="_blank">Watch</a>
Post Reply