After clicking on table tr, how can I display this data on another page?

我只是一个虾纸丫 提交于 2021-02-17 05:12:17

问题


This is my code for a website that displays videos from a MySQL database. 'videoRef' is the YouTube embed code that is stored in a video table.

$result=mysqli_query($link, "SELECT * FROM videos")
or die( mysqli_error($link) );

echo "<table border=0><tr><th>Title</th><th>Creator</th><th>Upload Date</th><th >Difficulty</th><th>Video</th></tr>";

while ($data = mysqli_fetch_array($result) ){
echo "<tr>";
echo "<td>" . $data['Title'] . "</td>";
echo "<td>" . $data['Creator'] . "</td>";
echo "<td>" . $data['Upload Date'] . "</td>";
echo "<td>" . $data['Difficulty'] . "</td>";
echo "<td>" . '<iframe width="350" height="200" src="https://www.youtube.com/embed/'.($data['videoRef']).'" allowfullscreen>
</iframe>' . "</td>";
echo "</tr>";
}

I would like to make it so that when a row is clicked, it will redirect to another page and start playing the respective video but the video dimensions are larger. Any help would be greatly appreciated :).


回答1:


The possible solutions:

  1. Include link with embed wideo with large dimensions:
<a href="https://www.youtube.com/embed/".$data['videoRef']><iframe>...</iframe></a>
  1. Include usual link to video:
<a href="https://www.youtube.com/watch?v=".$data['videoRef']><iframe>...</iframe></a>


来源:https://stackoverflow.com/questions/65794230/after-clicking-on-table-tr-how-can-i-display-this-data-on-another-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!