Here's the quick script to get all files from the directory:
<?php
if ($handle = opendir($directory_name)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$out[] = $file;
}
}
closedir($handle);
}
?>
Replace $directory_name with the path to the folder you want to search within.
After this code has been executed you will have array called $out which will store all files within the provided directory.
What you can do now - once you've submitted the search form with the value is:
if (isset($_GET['keyword'])) {
$keyword = $_GET['keyword'];
if (!empty($out) && in_array($keyword, $out)) {
echo "File has been found";
} else {
echo "File has not been found";
}
}
I hope this helps