title: Accessing Videos in Different Folder Through PHP
body: <p>I am pretty new to PHP, but I understand the basics. My problem is I have I have an index page that needs to have a list of the names of videos stored in a different folder. Since there will be over 100 videos in the folder by the time the site is live, I want the video names to be clickable, and when clicked the video plays.</p>
  
  <pre><code>&lt;?php
  $videopath = 'videos';
  $videoExts = array('webm'=&gt; 'video/webm','mp4'=&gt;'video/mp4','mpeg'=&gt;'video/mp4','ogv'=&gt;'video/ogv');
  $directory = "/videos";
  $phpfiles = glob($directory . "*.html");
  
  if ($handle = opendir($videopath)) {
      while (false !== ($file = readdir($handle))) {
          $info =pathinfo($file);
          $ext = strtolower($info['extension']);
          echo $file . " \n " . "\n &lt;br&gt; \n";
  
          if (array_key_exists($ext, $videoExts)) {      
  ?&gt;
     &lt;div class="flowplayer" data-swf="flowplayer.swf" data-ratio="0.4167"&gt;
        &lt;video&gt;
           &lt;source type="&lt;?php echo $videoExts[$ext]; ?&gt;" src="&lt;?php echo "$videopath/$file"; ?&gt;"&gt;
        &lt;/video&gt;
     &lt;/div&gt;
  
  &lt;?php
          }
      }
      closedir($handle);
  } else {
      echo "no dir";
  }
  
  ?&gt;
  </code></pre>
  
  <p>This code will list the video name (in text), and play each video. What can I do to modify this so that the video names become clickable and once clicked open the appropriate video?</p>