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. Quote 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"); Quote 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. Quote 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"); ?> Quote 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! Quote Link to comment https://forums.phpfreaks.com/topic/139948-php-include/#findComment-732239 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.