获取['id']的PHP活动菜单

时间:2014-06-20 11:58:57

标签: php menu

我使用菜单系统进行页面$_GET['id'],但我的代码不起作用。我该怎么办?

我的代码

的functions.php

function header_menu ($page) {
        echo "<ul>";
        if($page){
         echo "<li><a href='index.php'><span>Home</span></a></li>";
        }else {
         echo "<li><a class='active' href=\"index.php\"><span>Home</span></a></li>";
        }
        include ('admin/dbbaglan.php'); 
        $sql1 = mysql_query("SELECT * FROM sayfalar ORDER BY sira ASC");
        while($pages=mysql_fetch_array($sql1)) {
            if($page == $pages[id]) {
             echo "<li><a class=\"active\" href=\"index.php?pages={$pages['id']}\">{$pages['isim']}</a></li>\n";
            }else {
             echo "<li><a href=\"index.php?pages={$pages['id']}\">{$pages['isim']}</a></li>\n";
            }

        }
echo "</ul>";                   
}

我在header.php中显示菜单功能

<?php 
include 'functions.php'; 
header_menu($_GET[page]); 
?>

但页面处于活动状态时没有活动菜单

0 个答案:

没有答案