<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 

 <html> 

  <head> 

   <title> index.php </title> 

   <meta charset="UTF-8"> 

 </head> 



 <body> 

 <br><br> 

 <form method="post" action="PlayerPageGen.php"> 
  

<select name="filename"> 

   
<?php 

 

foreach(glob('./*.txt') as $txt) 

{ 

echo ' 
<option value="' . basename($txt) .'">' . basename($txt) . '</option> '."\n"; 

} 

?> 

</select> 

<br><input type="submit"> 

 </form> 

   <br> 







 <br> 



  </body> 
</html>

      <select id="selectForPlay" size="10" οndblclick="PointPlay(document.getElementById('selectForPlay').value);">
 <?php
         //fileRead.php
if(isset($_POST["filename"]))
{
$filename=$_POST["filename"];
   $myfile = fopen($filename, "r") or die("Unable to open file!");
}
else
{
$filename="exportLink_2016_04_09_16_20_57.txt";
   $myfile = fopen($filename, "r") or die("Unable to open file!");
}
$i=0;
while(!feof($myfile))
{
$lineFromFile=fgets($myfile);
$len=strlen($lineFromFile);
if($len<=1)
{
break;
}
else
{
$array=explode('|',$lineFromFile);
$fileName=++$i . '_' . $array[2];


echo '        <option value="' . $lineFromFile . '">' .$fileName . '</option>' . "\n";
}

}
fclose($myfile);
?>
       </select>