I am sharing the form/script below and appealing for help in expanding its capabilities.
I have a search form and php script which return a page in a browser which contains the sought after file in the form of a hyperlink which allows the file to be downloaded.
What I am trying to accomplish is the ability to type, or copy and paste, a list of items to be searched for simultaneously into the search box and have all of the found items returned in the browser in the form of a link to each of the files.
I have been trying to use a textarea form, as it will allow multiline input, but I can't figure out how to make the input name and input type control the textarea so that its contents will be searched for.
This is the form currently embedded in the html page:
form action="my_search_script.php" method="get"><big><input name="q"
type="text"> <input type="submit"></big></form>
This is the current script (my_search_script.php) which searches the directory where the files reside:
<?php
$dir = 'my_image_directory';
$exclude = array('.','..','.htaccess');
$q = (isset($_GET['q']))? strtolower($_GET['q']) : '';
$res = opendir($dir);
while(false!== ($file = readdir($res))) {
if(strpos(strtolower($file),$q)!== false &&!in_array($file,$exclude)) {
echo "<a href='$dir/$file'>$file</a>";
echo "<br>";
}
}
closedir($res);
?>
Any help is greatly appreciated.
Thank you,


