I have couple of html buttons in a .php page that are supposed to show files from directory containing .mp4/video files. I came across SCANDIR function which is working and shows the files in directory.
However, I need the listing to be interactive like click to play video (something like a href or hyperlink). Currently, the displayed list is just plain text.
I just need the listing to have a hyperlink to actual video files which I plan to play inside another html-div.
<button class="button-left" onclick="showLatestHits()"> Latest Hits</button>
<p id="song_genre">
function php_func_LatestHits()
{
$dir = 'music/Latest Hits';
$files = scandir($dir);
foreach ($files as $value) {
if ('.' !== $value && '..' !== $value && '.DS_Store' !== $value) {
echo "<br><br>" . $value;
}
}
}
var result_LatestHits = "<?php php_func_LatestHits(); ?>"
function showLatestHits() {
document.getElementById("song_genre").innerHTML = result_LatestHits;
}