Hi! Im very basic with PHP and trying for my first time with a simple site.
I have two menus in different files. One main menu and a submenu. My problem is when i click on o link in the submenu the style “slected” disappears from my main menu. I still want to have it selected. Here below is myc code for both menus.
main menu in header.php
<div id=“menu”>
<ul>
<?php
$home_url = ‘/index.php’;
$home_name = ‘Home’;
$news_url = ‘/sv/nyheter/index.php’;
$news_name = ‘News’;
if ($_SERVER[‘PHP_SELF’] == "$home_url ")
{
echo “<li class=“selected”><a href=’$home_url '> $home_name</a></li>”;
}
else
{
echo “<li><a href=’$home_url '> $home_name</a></li>”;
}
if ($_SERVER[‘PHP_SELF’] == “$news_url”)
{
echo “<li class=“selected”><a href=’$news_url’>$news_name</a><li>”;
}
else
{
echo “<li><a href=’$news_url’>$news_name</a><li>”;
}
?>
</ul>
</div>
and code in submenu.php
<ul class=“newsList”>
<?php
echo “<li><a href=‘2008-02-02.php’>link1</a></li>”;
echo “<li><a href=‘2008-02-02.php’>link2</a></li>”;
?>
</ul>
when I click on “link1” in submenu I still want to have the news button in main menu selected.
i was trying to send that variable in the link with something like this but it did not work.
echo “<li><a href=‘2008-02-02.php[COLOR=red]?news_url’[/COLOR]>link1</a></li>”;
(both files is included in a third file)
best regards
/Robert