0

I am using this code in a PHP include to give a class to the active page the user is currently browsing.

  <li id="nav11">
          <a <?php if ($_SERVER['REQUEST_URI']=="contact") echo " class=\"actv\""; ?> href="contact">Contact</a>
        </li>

My page is called http://www.domain.com/contact.php

However, nothing happens with my code above.

JoaMika
  • 1,727
  • 6
  • 32
  • 61

1 Answers1

0
 <li id="nav11">
      <a <?php if ($_SERVER['REQUEST_URI']=="/contact.php") echo " class=\"actv\""; ?> href="contact">Contact</a>
    </li>

Have you tried to change "contact" to "/contact.php"?

Pataar
  • 651
  • 8
  • 14