title: How to create a search tool that displays files in a folder as downloadable links by entering PARTIAL file names in php/html?
body: <p>I'm currently learning PHP, HTML, MySQL (as a hobby) and recently I got stuck trying to create a search tool in a web page where you can enter PART of the file name and it will display matching results as downloadable links</p>
  
  <p>Since I've only learned/learning HTML and PHP to create web pages, I tried some things I know but none of them worked the way I wanted it to. Then I started googling and found some code.</p>
  
  <p>here's one I've tried :</p>
  
  <pre><code>&lt;?php
  $dir = "uploads/../";
  if (is_dir($dir)) {
      if ($dh = opendir($dir)) {
          while (($file = readdir($dh)) !== false) {
              if($file == $_POST['file_name']){
                  echo('&lt;a href="'.$dir . $file.'"&gt;'. $file .'&lt;/a&gt;'."\n");
              }
          }
          closedir($dh);
      }
  }
  ?&gt;
  </code></pre>
  
  <p>it works BUT you have to enter the EXACT file name (extension and all) to get any results. This is impractical for what I want because I only remember parts of the file name</p>