In a pinch you can get this done with php sessions, simply set a variable any time a menu is switched.
The session variable should be set near the top of whatever page it is being used on, so that way PHP can recognize it before the menu loads on the page.
Here is a small snippet for inspiration, you could do this a lot of different ways.
<?
session_start();
if(isSet($_GET['switch'])) {
$_SESSION['menuPage'] = $_GET['switch'];
}
$menuPage = $_SESSION['menuPage'];
echo $menuPage."<br>";
?>
<ul class="menu">
<li <? if(strcmp($menuPage,"a") == 0) { echo "active"; } ?> class="a"><a href="?switch=a">A</a></li>
<li <? if(strcmp($menuPage,"b") == 0) { echo "active"; } ?> class="b"><a href="?switch=b">B</a></li>
<li <? if(strcmp($menuPage,"c") == 0) { echo "active"; } ?> class="c"><a href="?switch=c">C</a></li>
</ul>
Note: You want to use a session and not a normal variable so that the $_GET for the menu doesn't have to constantly be present in the URL.