robertnorgren Posted February 3, 2011 Share Posted February 3, 2011 Hi! I'd like to echo a text section from pageB.php to pageA.php Is it possible to mark it up somehow and tell the browser to echo the variable? I'm thinking something like this should work after some alteration: pageA: <?php echo pageb.php/variable; ?> pageB: <?php $variable = ***the content section I want to be displayed on pageA*** "; ?> I'd be very grateful if someone could help me out. (: Link to comment https://forums.phpfreaks.com/topic/226519-echo-a-section-of-another-page/ Share on other sites More sharing options...
requinix Posted February 3, 2011 Share Posted February 3, 2011 include "pageB.php"; echo $variable; $variable = "Content"; Link to comment https://forums.phpfreaks.com/topic/226519-echo-a-section-of-another-page/#findComment-1169168 Share on other sites More sharing options...
robertnorgren Posted February 3, 2011 Author Share Posted February 3, 2011 Thanks! However, the code provided prints the entire pageB onto pageA. I'm pretty sure I'm doing it right. Have you tested the code? Regards. Link to comment https://forums.phpfreaks.com/topic/226519-echo-a-section-of-another-page/#findComment-1169589 Share on other sites More sharing options...
litebearer Posted February 3, 2011 Share Posted February 3, 2011 perhaps using sessions may help Link to comment https://forums.phpfreaks.com/topic/226519-echo-a-section-of-another-page/#findComment-1169591 Share on other sites More sharing options...
BlueSkyIS Posted February 3, 2011 Share Posted February 3, 2011 based on your example, there is only the variable definition in pageB. if there is more than that, it will also be include()'ed. Link to comment https://forums.phpfreaks.com/topic/226519-echo-a-section-of-another-page/#findComment-1169593 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.