搜索引擎在自己的网站[关闭]

Hi guys I'm trying to make a search engine in my website. Search engine must browse in a category and after search must display all results. But the engine doesn't display the results.

Example: X user is searching in PC-games for Y game. The X user type in text area the name of game and then click button search. After search script doesn`t display the results of Y game. Here is my script

<form action="search.php" method="POST">
<p><br />
<input name="q" type="hidden" />
<font color="black">Hunt Data:</font>
<input name="qfront" type="text" style="width: 230px" name="nume"id="nume" />
<select name="category">
<option value="0">All</option>
<option value="1">PC-Games</option>
<option value="2">Console</option>
<option value="3">Movies</option>
<option value="4">Music</option>
<option value="5">XXX</option>
<option value="6">Windows</option>
<option value="7">Linux</option>
<option value="8">Software</option>
<option value="9">Documents</option>
<input type="submit" value="Search" />
</p>
</form>

PHP script

<html>
<body>
<center>
<font color="black" size="4">
<?php
//define each directory here, the index starts with 0 == all and so on.
$categorydir = array('/Category/All/', '/Category/PCGames/', '/Category/Console/', '/Category/Movies/', '/Category/Music/', '/Category/XXX/', '/Category/Windows/', '/Category/Linux/', '/Category/Software/', '/Category/Documents/');
//if option selected and its valid number
if (isset($_POST['category'])) 
    if(ctype_digit($_POST['category']) && isset($categorydir[$_POST['category']])) {
        if(array_key_exists($_POST['category'], $categorydir) && is_dir($categorydir[$_POST['category']])) {
            $handle = opendir($categorydir[$_POST['category']]); //LINE 14
            $files = scandir($handle);
            echo 'Results of search:<br></br>';
            foreach($files as $file){ //LINE 17
                echo($file);
            }
        } else {
            echo 'target directory not found';
    }
}
?>
</font>
</center>
</body>
</html>
<html>
<head>
<title>DataHunters</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="header">
<h1 id="logo"><a href="index.html">DataHunters</a>
</h1>
</div>
<div id="navigation">
<ul>
<li><a class="active" href="index.html">Home</li></a>
<li><a href="chat.html">Chat</li></a>
<li><a href="contact.html">Contact</li></a>
<li><a href="http://www.forum.datahunters.ro">Forum</li></a>
</ul>
</li>
</div>
</body>
</html>

Here, I'll post that as an answer if you feel you can close this.

I think your issue is that scandir takes a string argument for the directory, not a file handle.

As people are saying, you should really take the time to learn more about databases. There are many tutorials available on the web and this is pretty much a required skill to posses for any sort of development. MySQL and PDO is a good place to start.

Good luck.