herghost Posted March 24, 2010 Share Posted March 24, 2010 Hi all, I am trying to include using a line like this: <?php include('menus/customerdetails.php?id=' . $id . ''); ?> Which does not work! Basically this should be a custom menu for the user with the id of $id. It works if I remove everything from ? onwards, otherwise get this error: Warning: include(menus/customerdetails.php?id=136) [function.include]: failed to open stream: Is there a way to do this so i can use $_get['id']? Or will I have to store it in a session? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/196337-custom-include-string/ Share on other sites More sharing options...
JonnoTheDev Posted March 24, 2010 Share Posted March 24, 2010 The GET data should be available within the include file i.e <?php // originating file include('menus/customerdetails.php'); ?> <?php // customerdetails.php print $_GET['id']; exit(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/196337-custom-include-string/#findComment-1030963 Share on other sites More sharing options...
Daniel0 Posted March 24, 2010 Share Posted March 24, 2010 From the manual on include: When a file is included' date=' the code it contains inherits the variable scope of the line on which the include occurs. Any variables available at that line in the calling file will be available within the called file, from that point forward.[/quote'] Quote Link to comment https://forums.phpfreaks.com/topic/196337-custom-include-string/#findComment-1030970 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.