I am trying to add run all the mp3 files from a directory and I am getting those mp3 files using glob() function in PHP. The problem I am facing is that only one mp3 file run again and again and not all of them
Please have a loook at my code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<audio controls autoplay loop = "loop">
<?php $audios = glob("*.mp3*");
for($i = 0; $i < count($audios); $i++)
echo "<source src = '".$audios[$i]."' type = 'audio/mp3'>";
?>
</audio>
</body>
</html>
The problem isn't with your PHP script (at least not directly). The problem is the tag only supports a single nested tag of the same file type.
Have a look at this SO question for more info: