jesushax Posted June 18, 2008 Share Posted June 18, 2008 hi i was wondering if in php we can load content from alink into our page without ajax or frames etc just php for example Username: Geoff Bill Fred So i click Geoff and then a form below is shown with geoffs info on, the form can be from another page or if need be ill put it on the same page in a function or something, is this easy and do able in php? Quote Link to comment https://forums.phpfreaks.com/topic/110717-solved-load-content-from-link-withouth-ajax/ Share on other sites More sharing options...
trq Posted June 18, 2008 Share Posted June 18, 2008 Of course. This is the basics of dynamic web development. <?php if (!isset($_GET['user'])) { echo "Username:<br />"; echo "<a href='?user=geoff'>Geoff</a><br />"; echo "<a href='?user=bill'>Bill</a><br />"; echo "<a href='?user=fred'>Fred</a><br />"; } else { switch ($_GET['user']) { case 'geoff': echo "This is Geoff's information"; break; case 'bill': echo "This is Bill's information"; break; case 'Fred': echo "This is Fred's information"; break; default: echo "User not found"; } } ?> The information within the switch can come from wherever you like, be it a database query or a seperate file. I just hardcoded as an example. Quote Link to comment https://forums.phpfreaks.com/topic/110717-solved-load-content-from-link-withouth-ajax/#findComment-568037 Share on other sites More sharing options...
jesushax Posted June 18, 2008 Author Share Posted June 18, 2008 i know abotu switches my site has 100s of them let me re phrase a bit, how can i do it without reloading the page, or should i just add some more switches to my current pages and let it reload? cheers Quote Link to comment https://forums.phpfreaks.com/topic/110717-solved-load-content-from-link-withouth-ajax/#findComment-568039 Share on other sites More sharing options...
trq Posted June 18, 2008 Share Posted June 18, 2008 You can't do it without reloading the page. PHP runs on the server, hence a request needs to be made to the server. Quote Link to comment https://forums.phpfreaks.com/topic/110717-solved-load-content-from-link-withouth-ajax/#findComment-568041 Share on other sites More sharing options...
jesushax Posted June 18, 2008 Author Share Posted June 18, 2008 hmmm, ok ill decide what to do laters Cheers Quote Link to comment https://forums.phpfreaks.com/topic/110717-solved-load-content-from-link-withouth-ajax/#findComment-568042 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.