soulscriber Posted April 23, 2007 Share Posted April 23, 2007 Hi, I'm relatively new to PHP. I have a shopping cart template (leftcolumn template), that I want to show a different div depending on what the URL of the page is. For example, if the category id in the url is 250, then I want a certain div to display, but if the category url is 248, then I want a different div to display. Basically, how do I fetch the url info and then have that info change the content on the fly. Remembering that this is a template file. Any help would be greatly appreciated, thanks! Link to comment https://forums.phpfreaks.com/topic/48334-dynamically-show-content-based-on-url-with-php/ Share on other sites More sharing options...
tarun Posted April 23, 2007 Share Posted April 23, 2007 $id = $_POST["id"]; if ( $id == "1" ) { echo '<div>DIV 1</div>'; } elseif ( $id == "2" ) { echo '<div>DIV 2</div>'; } else ( $id == "3" ) { echo '<div>DIV 3</div>'; } Link to comment https://forums.phpfreaks.com/topic/48334-dynamically-show-content-based-on-url-with-php/#findComment-236312 Share on other sites More sharing options...
Mr. R Posted April 23, 2007 Share Posted April 23, 2007 say the URL is www.blah.com/index.php?id=243 <?php $id = $_GET['id']; ?> $id will contain the value 243 Link to comment https://forums.phpfreaks.com/topic/48334-dynamically-show-content-based-on-url-with-php/#findComment-236313 Share on other sites More sharing options...
soulscriber Posted April 23, 2007 Author Share Posted April 23, 2007 Thanks a lot! Link to comment https://forums.phpfreaks.com/topic/48334-dynamically-show-content-based-on-url-with-php/#findComment-236340 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.