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 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(); ?> 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'] Link to comment https://forums.phpfreaks.com/topic/196337-custom-include-string/#findComment-1030970 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.