I want to show movie trailer by click on movie button. i have done this by using colorbox. i had include .js and .css file in my template.php file. and i prepare following code for this. but i can't able to do this. plz anyone guide me. how can i show trailer in my website? i had store trailer path in my database for partcular movies.
My code is as:
trailer.php
<?
require_once("template.php");
function main() {
?>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
<?php
$sql = "select * from movie";
$result = mysql_query($sql);
?>
<table>
<tr>
<?php
$i = 0;
while ($rows = mysql_fetch_array($result)) {
if ($i % 3 == 0) {
echo '</tr><tr>';
}
?>
<td>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td valign="center">
<img src="<?php echo "images/thumbnail/" . $rows['image']; ?>" height="130" width="100" border="0" /><br>
</td>
<td valin="" width="200" style="padding-left: 10px;">
<font size="4">
<?php
echo "<b>Stars</b>" . '<br>' . "<font size='3'>" . $rows['actor'] . "</font>" . '<br>';
echo "<font size='3'>" . $rows['actress'] . "</font>" . '<br><br>';
echo "<b>Director</b>" . '<br>' . "<font size='3'>" . $rows['director'] . "</font>" . '<br>';
?>
</font>
</td>
</tr>
<tr>
<td align="left" valign="center">
<a href="trailer_redirect.php?movie_id=<? echo $rows['movie_id']; ?> ">
<!-- <img src="images/buy_tickets.jpg" width="79" height="18" alt="buy_tickets" border="0"/>-->
<input type="submit" value="View Trailer" name="view_trailer" />
</a>
</td>
<td> </td>
</tr>
</table>
</td>
<?php
$i++;
// if(isset($_POST['view_trailer'])) {
// header("location: trailer_redirect.php");
// }
}
?>
</tr>
</table>
</td>
</tr>
</table>
<?
}
?>
trailer_redirect.php
<?php
require_once 'template.php';
//require_once 'dbconfig.php';
function main() {
//get value of id that sent from address bar
$id = $_GET['movie_id'];
// Retrieve data from database
$sql = "SELECT * FROM movie WHERE movie_id='$id'";
$result = mysql_query($sql);
$rows = mysql_fetch_array($result);
?>
<?php while($rows= mysql_fetch_array($result)){ ?>
<head>
<style>
body{font:12px/1.2 Verdana, sans-serif; padding:0 10px;}
a:link, a:visited{text-decoration:none; color:#416CE5; border-bottom:1px solid #416CE5;}
h2{font-size:13px; margin:15px 0 0 0;}
</style>
<script>
$(document).ready(function(){
$(".youtube").colorbox({iframe:true, innerWidth:425, innerHeight:344});
$(".iframe").colorbox({iframe:true, width:"80%", height:"80%"});});
// $(".callbacks").colorbox({
// onOpen:function(){ alert('onOpen: colorbox is about to open'); },
// onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
// onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
// onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
// onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
// });
//Example of preserving a JavaScript event for inline calls.
$("#click").click(function(){
$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
return false;
});
</script>
</head>
<body>
<p><a class='youtube' href="<?php echo $rows['trailor_path']; ?>" title="The Knife: We Share Our Mother's Health">Flash / Video (Iframe/Direct Link To YouTube)</a></p>
</body>
<?php }
}
?>