Ok, i have a site funzac.com/sitec which is for a school project. I need the links at the top to have the css mouseover applied if it is on that current page. To do this i figured i would need to get the url with php and then have something in the link style to tell it if 1 do and if 0 display normal. this is as far as i got before i completly mind blanked <?php $url = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; ?> <div class="header"> <a href="index.php"><img class="image" src="images/homepage.png" width="500" height="80"/></a> <div class="navigation"> <a style="<? if{$url == href ?>" href="index.php">Home</a> <a href="about.php">About</a> <a href="contact.php">Contact</a> <a href="hours.php">Hours</a> <a href="location.php">Location</a> <a href="services.php">Services</a> </div> </div> Code (markup):
$php_self will output the file name so you would use if($php_self=="index.php"){ // do something } PHP:
This is what i now have: <a style="<? if($php_self=="./"){echo"border-bottom: 3px solid #FFFFFF;color: #FFFFFF;";}?>" href="index.php">Home</a> Code (markup): It only works if i put else and then put the same code but then it doesnt turn off. SO basically the =="./" is wrong. I need it to be if php_self = current page i think.