amplexus Posted August 10, 2012 Share Posted August 10, 2012 Hi again, I've got a php include for a Navigation list, and I'm trying to get it to add the id tag to the current page. my code looks like this: <a href="order.php"<?php if ($currentpage == 'order.php') {echo 'id="here"';} ?>>Order Lobsters</a> |<a href="about.php"<?php if ($currentpage == 'about.php') {echo 'id="here"';} ?>>About Us</a> |<a href="crew.php"<?php if ($currentpage == 'crew.php') {echo 'id="here"';} ?>>Our Crew</a> |<a href="rental.php"<?php if ($currentpage == 'rental.php') {echo 'id="here"';} ?>>Rental Property</a> |<a href="contact.php"<?php if ($currentpage == 'contact.php') {echo 'id="here"';} ?>>Contact Us</a> |<a href="facility.php"<?php if ($currentpage == 'facility.php') {echo 'id="here"';} ?>>Our Green Facility</a> I'm not getting any errors, just not working. if I remove the "if" statement, the echo works, so I know my problem is there. maybe I have the wrong syntax for the page name string? where is it looking to get that information? I've only tested on my local xampp server, but these are relative links, no? thanksi n advance for your help. Quote Link to comment https://forums.phpfreaks.com/topic/266908-using-php-to-add-id-to-an-element-based-on-current-page/ Share on other sites More sharing options...
gristoi Posted August 10, 2012 Share Posted August 10, 2012 where is $currentpage defined? Quote Link to comment https://forums.phpfreaks.com/topic/266908-using-php-to-add-id-to-an-element-based-on-current-page/#findComment-1368355 Share on other sites More sharing options...
amplexus Posted August 10, 2012 Author Share Posted August 10, 2012 huh. whaddya know. thanks! Quote Link to comment https://forums.phpfreaks.com/topic/266908-using-php-to-add-id-to-an-element-based-on-current-page/#findComment-1368361 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.