PHP在搜索后发布数据

PHP在搜索后发布数据,php,search-engine,postdata,Php,Search Engine,Postdata,我已经做了一个脚本(在一些帮助下)谁在一个类别中搜索。例子: 我们有下一个类别:游戏、电影和音乐。X用户正在PCgames类别中搜索Y游戏。在搜索脚本most post之后,必须显示所有结果,但脚本不显示结果。要帮忙吗? 下面是在类别中搜索的php脚本 <?php //define each directory here, the index starts with 0 == all and so on. $categorydir = array('/Category/All/',

我已经做了一个脚本(在一些帮助下)谁在一个类别中搜索。例子: 我们有下一个类别:游戏、电影和音乐。X用户正在PCgames类别中搜索Y游戏。在搜索脚本most post之后,必须显示所有结果,但脚本不显示结果。要帮忙吗? 下面是在类别中搜索的php脚本

    <?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']]);
 }else{
   echo 'target directory not found';
 }
else{
 //please enter an option
}
?>


你的代码很难理解。你能举一个更好的例子来说明从用户搜索到它应该做什么的流程吗?所以请注意:这个脚本在一个类别中搜索。示例:我们有下一个类别:游戏、电影和音乐。X用户正在PCgames类别中搜索Y游戏。但是脚本不会发布搜索结果,所以搜索后页面是空白的。我需要一个脚本谁张贴在搜索页面上找到的所有文件。