iconicCreator Posted February 25, 2011 Share Posted February 25, 2011 Good day everyone! I know this is possible but I do not know how to do it. I have a single page, this page has no dynamic content. I have a set of links. What I need is to have content placed on the page based on the link the user clicks. Example: I have pictures of animals. When the user click a Zebra, the Zebra info is placed on the page. So the page does not change, meaning the content on the page changes but not the page it self. The idea is instead of creating different html pages for each animal profile, the profile is generated to the page from a php include file. Is is this possible? Can anyone, some one please point me to how I can get this going. Thanks everyone! IC Quote Link to comment https://forums.phpfreaks.com/topic/228842-using-php-to-generated-different-content-to-a-single-page/ Share on other sites More sharing options...
jcbones Posted February 26, 2011 Share Posted February 26, 2011 Start Here Then Go here Of course, when you get stuck, post the code that is troubling you. Quote Link to comment https://forums.phpfreaks.com/topic/228842-using-php-to-generated-different-content-to-a-single-page/#findComment-1179833 Share on other sites More sharing options...
Krash Posted February 26, 2011 Share Posted February 26, 2011 Use iframes. Quote Link to comment https://forums.phpfreaks.com/topic/228842-using-php-to-generated-different-content-to-a-single-page/#findComment-1179838 Share on other sites More sharing options...
d3rck Posted February 26, 2011 Share Posted February 26, 2011 I think what you are trying to do is change the links in a way that when you click on the link it shows on the same page? Try: echo " <table> <tr> <td>"; echo "<a href='index.php?p=somewhere"> Somewhere </a>"; echo" </td> </tr> "; $somewherevariable = $_GET['p']; if(isset($somewherevariable)) { $path = "foldername/" . $somewherevariable . ".php"; } include ($path); echo" <tr> <td> "; echo" </td> </tr>"; Hope this helps you. Just reply if you need help. Quote Link to comment https://forums.phpfreaks.com/topic/228842-using-php-to-generated-different-content-to-a-single-page/#findComment-1179928 Share on other sites More sharing options...
litebearer Posted February 26, 2011 Share Posted February 26, 2011 OR, look at this ... http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm Quote Link to comment https://forums.phpfreaks.com/topic/228842-using-php-to-generated-different-content-to-a-single-page/#findComment-1179941 Share on other sites More sharing options...
iconicCreator Posted February 26, 2011 Author Share Posted February 26, 2011 I think what you are trying to do is change the links in a way that when you click on the link it shows on the same page? Try: echo " <table> <tr> <td>"; echo "<a href='index.php?p=somewhere"> Somewhere </a>"; echo" </td> </tr> "; $somewherevariable = $_GET['p']; if(isset($somewherevariable)) { $path = "foldername/" . $somewherevariable . ".php"; } include ($path); echo" <tr> <td> "; echo" </td> </tr>"; Hope this helps you. Just reply if you need help. Thank you very much for your time and effort! I know a bit of PHP so I can understand the codes a little. I seem to be understanding most except the somewhere variable. Will the somewhere variable contained the content that is written when the link is click? example: <?php $somewherevariable = "animal profile"; ?> Thanks again! IC Quote Link to comment https://forums.phpfreaks.com/topic/228842-using-php-to-generated-different-content-to-a-single-page/#findComment-1180039 Share on other sites More sharing options...
iconicCreator Posted February 26, 2011 Author Share Posted February 26, 2011 OR, look at this ... http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm This looks like what I need, thanks for the link I am looking at the possibilities as to how I can use this. Thanks again! IC Quote Link to comment https://forums.phpfreaks.com/topic/228842-using-php-to-generated-different-content-to-a-single-page/#findComment-1180041 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.