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! Quote Link to comment 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>'; } Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
soulscriber Posted April 23, 2007 Author Share Posted April 23, 2007 Thanks a lot! Quote Link to comment 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.