Hi experts, below are codes i learn from php video tutorial :
<?php require_once("includes/connection.php"); ?>
<?php require_once("includes/functions.php"); ?>
<?php
if(isset($_GET)) {
$sel_subj = $_GET ;
$sel_page = "";
} elseif (isset($_GET)) {
$sel_subj = "";
$sel_page = $_GET ;
} else {
$sel_subj = "";
$sel_page = "";
}
?>
<?php include("includes/header.php"); ?>
<table id="structure">
<tr>
<td id="navigation">
<ul class="subjects">
<?php
$subject_set = get_all_subjects();
while ($subject = mysql_fetch_array($subject_set)) {
echo "<li";
if ($subject["id"] == $sel_subj) {
echo " class=\"selected\"";
}
echo "><a href=\"content.php?subj=" . urlencode($subject["id"]) .
"\">{$subject["menu_name"]}</a></li>";
$page_set = get_pages_for_subject($subject["id"]);
echo "<ul class=\"pages\">";
while ($page = mysql_fetch_array($page_set)) {
echo "<li><a href=\"content.php?page=" . urlencode($page["id"]) .
"\">{$page["menu_name"]}</a></li>";
}
echo "</ul>";
}
?>
</ul>
</td>
<td id="page">
<h2>Content Area</h2>
<?php echo $sel_subj; ?><br/>
<?php echo $sel_page; ?><br/>
</td>
</tr>
</table>
<?php require("includes/footer.php"); ?>
The output of the above link basically is a page with navigator on the left side of the page , the navigation items are :
About Widget Corp
-History
-Our Mission
Products
-Widget 2000
Services
the <ul> refers to a class from a CSS stylesheet file where item being SELECTED will become BOLD.
The scripts should work like this if everything is correct , when user click 'About Widget Corp or Products or Services' (as being the subject), the subject will become bold. But the result i get here is that when i clicked 'About Widget Corp' , the submenu (History, Our Mission) become BOLD too, which is not the result that i wanted, it should be only 'About Widget Corp' become bold, and it happens to 'Products' too, when i clicked 'Products', instead of only 'Products' become BOLD, the submenu (widget 2000) also becomes BOLD.
Thanks alot