I am creating a video gallery in PHP and MYSQL. The gallery have video thumbnail and text captions under them. When the user click on the image thumbnail or the text caption, it will take them to another web page that will display the video and the caption under it. I want the caption that the user clicked on to be the same caption that is displayed under the video when they are forwarded to the video web page. How do I pass the caption that is under my thumbnail when its clicked, so it can be send to another webpage? I want the caption that is clicked on to displayed under the video. This is the code for gallery.php :
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<?php
$con=mysqli_connect("localhost","root","","image_display");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result=mysqli_query($con,"select * from table1");
while($row=mysqli_fetch_array($result,MYSQLI_ASSOC))
{
$image_link = $row['imagelink'];
$image_path = $row['image1'];
$caption = $row['caption'];
echo "<div id='gallery'>";
echo "<a href=".$image_link.val=$caption" value="fixed text"><img src=".$image_path." width='150' height='150' alt='' /> <br>";
echo $caption."</a>"; echo "</div>";
}
?>
</body>
</html>
This is the code for display_video.php:
<!DOCTYPE html>
<html>
<head>
<title>PHP!</title>
</head>
<body>
<?php
$caption=$_GET['caption'];
$embedvideo; //This will hold embed video code
?>
<div id="watchvideo" align="center">
<?php
echo "<h1>$caption=</h1>";
echo $embedvideo; ?>
<p><a href="gallery.php">Back to gallery</p>
</div>
</body>
</html>