I'm working on a music playlist code with PHP, so I'm putting the command to play the song by the $ filename variable:
echo "<br><embed src=\"$folder/$filename\" widht=1 height=50><br>";
But when I run this command, it plays all the songs in the folder and not one by one (neatly) as I would like. How can I do this? Here are the complete codes:
index.php
<?php
header('Content-type: text/html; charset=ISO-8859-1');
echo '<form action="list.php">';
echo "<h4>Write your songs folder</h4><br>";
echo "<h5>(DON'T WRITE A BAR IN THE END OR WRITE ANY SPECIAL CHARACTER)</h5>";
echo '<input type="text" name="folder">';
echo '<input type="submit">';
echo "</form>";
list.php
<?php
header('Content-type: text/html; charset=ISO-8859-1');
$folder = $_GET["folder"];
$files = "{$folder}/".$_GET['/*.*'];
if(isset($_GET['folder']) && file_exists("{$folder}/".$_GET['/*.*'])){
$fold = opendir($folder);
while (false !== ($filename = readdir($fold))) {
if (substr($filename,-4) == ".mp3") {
echo "<br><embed src=\"$folder/$filename\" widht=1 height=50><br>";
}
}
}