We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,301 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

selected navigation problem

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

2
Contributors
1
Reply
2 Hours
Discussion Span
1 Year Ago
Last Updated
2
Views
phpbeginnerx
Newbie Poster
1 post since Mar 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 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.

urtrivedi
Posting Virtuoso
1,714 posts since Dec 2008
Reputation Points: 299
Solved Threads: 362
Skill Endorsements: 24

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0739 seconds using 2.95MB