So my problem is that I got a number of pages that I gather from my database and output in a echo. I then want to make a highlight which displays what pages you on.
I have managed by myself to make it highlight the selected page when you click it but I can't manage to get the index page to get highlighted when visiting for example
"www.test.com" I have to be on a page like this "www.test.com/index" for it to work. Hard to explain but I will show you my code and it might become more clearly.


PHP Code:
$sqlmenu mysql_query ("SELECT id, label FROM pages ORDER BY pageorder ASC");

$menuDisplay '';
$row mysql_fetch_array($sqlmenu)){
$mid $row["id"];
$label $row["label"];
$menuDisplay .= '<li><a href="index.php?mid=' $mid '">' $linklabel '</a></li>';
        var i = document.location.href.lastIndexOf("/");
        var currentPHP = document.location.href.substr(i+1);
        $("ul#main-menu li a").removeClass('activeNavBtn');
        $("ul#main-menu li a[href^='"+currentPHP+"']").addClass('activeNavBtn');