batstanggt Posted July 20, 2011 Share Posted July 20, 2011 Just as the subject suggests is it possible with PHP or do I have to learn javascript now too as well lol.... -SB Quote Link to comment https://forums.phpfreaks.com/topic/242406-link-to-div-on-same-page-possible-with-php/ Share on other sites More sharing options...
Maknib Posted July 20, 2011 Share Posted July 20, 2011 i believe this is done with html something like: <a href="#link1"> <div id="link1"> this will go down to that div. Quote Link to comment https://forums.phpfreaks.com/topic/242406-link-to-div-on-same-page-possible-with-php/#findComment-1244997 Share on other sites More sharing options...
batstanggt Posted July 20, 2011 Author Share Posted July 20, 2011 right but what if i wanted to load an external page to it ? How would i go about that? -SB Quote Link to comment https://forums.phpfreaks.com/topic/242406-link-to-div-on-same-page-possible-with-php/#findComment-1244998 Share on other sites More sharing options...
batstanggt Posted July 20, 2011 Author Share Posted July 20, 2011 In do my own research its looking increasingly like javascript is my only option. Any other suggestions besides the aforementioned? I thought about using include() or header right in the div tag but i dont know if that will accomplish what im looking to do. -SB Quote Link to comment https://forums.phpfreaks.com/topic/242406-link-to-div-on-same-page-possible-with-php/#findComment-1245000 Share on other sites More sharing options...
Guest MrLeN Posted July 20, 2011 Share Posted July 20, 2011 Can you reword your request? I am not really following what you want to do O_o Quote Link to comment https://forums.phpfreaks.com/topic/242406-link-to-div-on-same-page-possible-with-php/#findComment-1245006 Share on other sites More sharing options...
Psycho Posted July 20, 2011 Share Posted July 20, 2011 If you want to do this with PHP, you will need to reload the page whenever the user clicks the link. Then redisplay the page with the changed content in that div. If you want to do this such that the content is updated in the div without refreshing the page, then you need to use AJAX: combination of client-side (JavaScript) and server-side (in this case PHP). You could look into using jQuery, a javascript framework, that makes it fairly easy to implement some AJAX. Do a search for "jquery AJAX tutorial" and see if it is something you want to tackle. Well, there is another option: frames. but, frames suck. Quote Link to comment https://forums.phpfreaks.com/topic/242406-link-to-div-on-same-page-possible-with-php/#findComment-1245029 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.