1,105,416 Community Members

selected navigation problem

Member Avatar
phpbeginnerx
Newbie Poster
1 post since Mar 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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

Member Avatar
urtrivedi
Posting Virtuoso
1,897 posts since Dec 2008
Reputation Points: 249 [?]
Q&As Helped to Solve: 409 [?]
Skill Endorsements: 27 [?]
 
0
 

upload all php file used in this page, with sql data structure and sample data. so that we can have complete look to script.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article