title: Active link with PHP
body: <p>I have been reading lots of posts about this issue but I couldnt reach to a good solution so I may need your help on this. </p>
  
  <p>I have a index.php which has a header.php included. The idea would be that when I click on some other page for ex: page2 that the link in the header.php changes to active to the correspondingly page. </p>
  
  <p>Like any other normal navigation should work.=)</p>
  
  <p>At the moment, this is what I have so far and it is not working. Do you know why? Could you help me please?</p>
  
  <p>Thanks in advance,</p>
  
  <p>//in the index.php I have this:</p>
  
  <pre><code>&lt;body&gt;
  &lt;div id="wrapper"&gt;
      &lt;!--HEADER--&gt;
      &lt;?php include_once("header.php"); ?&gt;
      &lt;!-- HEADER --&gt;
      &lt;div id="mainContainer"&gt;
          &lt;div class="inner-main"&gt;
              &lt;!--MAIN--&gt;
              &lt;?php $page = "home"; ?&gt;
              &lt;?php include_once("includes/home.php"); ?&gt;
              &lt;!--MAIN--&gt;
          &lt;/div&gt;
      &lt;/div&gt;&lt;!--mainContainer--&gt;
  &lt;/div&gt;&lt;!--wrapper--&gt;&lt;/body&gt; 
  </code></pre>
  
  <p>//Inside the header.php I have the following:</p>
  
  <pre><code>&lt;div id="header"&gt;
  &lt;div class="inner-header"&gt;
      &lt;div class="top-nav"&gt;
          &lt;ul id="nav" class="nav clearfix"&gt;
              &lt;li class="&lt;?php echo ($page == "home" ? "selected" : "")?&gt;"&gt;&lt;a href="home.php"&gt;HOME&lt;/a&gt;&lt;/li&gt;
              &lt;li class="division"&gt;&amp;bull;&lt;/li&gt;
              &lt;li class="&lt;?php echo ($page == "page2" ? "selected" : "")?&gt;"&gt;&lt;a href="page2.php" target="_self"&gt;PAGE 2&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;&lt;!--nav--&gt;
      &lt;/div&gt;&lt;!--top-nav--&gt;
  &lt;/div&gt;&lt;!--inner-header--&gt;&lt;/div&gt;&lt;!-- header--&gt;
  </code></pre>
  
  <p>//So what if I click on page2 on the top nav? How can I do to view page.php and also the corresponding link be active in the top navigation?</p>