PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<form action="page.php?name=Library&file=search" method="POST"><input size="25" type="text" name="query" value=""> <input type="submit" value="Search"></form>
<?php //...
$term = trim($_POST['query']);
$files = glob($dir."modules/Library/files/*");
foreach( $files as $key => $value ){
if(preg_match("#".$term."#i", $value))
$file = basename($value); // $file is set to "index.php"
echo "<a href=\"page.php?name=Library&file=file&page=$value\">$file</a><br>";
} ?>
But the problem is that the results returned are returned like like 1000 times dispending of how many match the query. So it would look something like (if 1 file matches the query)