I have removed the the navigation part from all the files and kept in a separate file named nav.php and then called it at the required place as
include ('includes/nav.php');
The content of the nav.php file is as follows:
<ul>
<li<?php if ($thisPage=="http://www.finalyearondesk.com")
echo " class=\"selected\""; ?>>
<a href="http://www.finalyearondesk.com">Home</a></li>
<li<?php if ($thisPage=="http://www.finalyearondesk.com/contact.php")
echo " class=\"selected\""; ?>>
<a href="http://www.finalyearondesk.com/contact.php">Contact US</a></li>
<li<?php if ($thisPage=="http://www.finalyearondesk.com/downloads.php")
echo " class=\"selected\""; ?>>
<a href="http://www.finalyearondesk.com/downloads.php">Downloads</a></li>
</ul>
But the problem is I can not get the current item selected when that page is visited.
What is wrong is with my code?
You are not assigning value to $thisPage. Add this following code before the ul in nav.php