slater2009 Posted January 8, 2009 Share Posted January 8, 2009 I'm new to this forum, but I have a feeling it's going to be my 2nd home lol. I'm having trouble with this PHP include script I'm using <?php if($page) include("$page.php"); else include("main.php"); ?> The script includes the "main.php" file fine, but when I link other pages as ?page=pagename.php, they don't even link, let alone target the area where the script is. My website is at http://www.digitalgold.org I am trying to target the links on the left hand side to the middle area. Any help would be greatly appreciated. Thanks. Link to comment https://forums.phpfreaks.com/topic/139948-php-include/ Share on other sites More sharing options...
dclamp Posted January 8, 2009 Share Posted January 8, 2009 remove the quotes, should work fine. include($page . ".php"); Link to comment https://forums.phpfreaks.com/topic/139948-php-include/#findComment-732230 Share on other sites More sharing options...
slater2009 Posted January 8, 2009 Author Share Posted January 8, 2009 No success man. Link to comment https://forums.phpfreaks.com/topic/139948-php-include/#findComment-732233 Share on other sites More sharing options...
sasa Posted January 8, 2009 Share Posted January 8, 2009 try <?php $page = $_GET['page']; if($page) include("$page.php"); else include("main.php"); ?> Link to comment https://forums.phpfreaks.com/topic/139948-php-include/#findComment-732236 Share on other sites More sharing options...
slater2009 Posted January 8, 2009 Author Share Posted January 8, 2009 Awesome, it works. Thanks a million! Link to comment https://forums.phpfreaks.com/topic/139948-php-include/#findComment-732239 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.