Hi guys i am new here..i am not have more experience with php.I have one good script ,this search on folder from name the file,example pdf file.Worked ok all goood but i need add the limit rezult for show because i search pdf name for example and this show me all file pdf,no have limit on page for rezult.I need limit this only 15 rezults,and another question possible add the messsage file not found for rezult nothing existent.
thanks you very much!!

<?php
    $dir = 'data'; 
    $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); 
    ?>

and here is html

<form action="file.php" method="get">
<input name="q" type="text" /> 
<input type="submit" />
</form>