beyzad Posted November 27, 2007 Share Posted November 27, 2007 Hi dears. I've got a problem with INCLUDE . so i need to include a file name such as 'menu.php?id=1" But i'll get this: Warning: include(menu.php?id=1) [function.include]: failed to open stream: Invalid argument in C:\wamp\www\sang darmani\dd.php on line 60 Warning: include() [function.include]: Failed opening 'menu.php?id=1' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\sang darmani\dd.php on line 60 Can anyone help please?? :-X Quote Link to comment Share on other sites More sharing options...
~n[EO]n~ Posted November 27, 2007 Share Posted November 27, 2007 Why do you want to do this way ??? IF you know the id in menu.php just store in the session and echo out where you include for e.g. menu.php (will contain the id) <?php session_start(); $id = "hello"; $_SESSION['id'] = $id; ?> and suppose index.php where you include menu will have this... <?php include "menu.php"; echo $_SESSION['id']; ?> Quote Link to comment Share on other sites More sharing options...
Lumio Posted November 27, 2007 Share Posted November 27, 2007 Why should he save it in $_SESSION. Just use a normal variable. Quote Link to comment Share on other sites More sharing options...
~n[EO]n~ Posted November 27, 2007 Share Posted November 27, 2007 Why should he save it in $_SESSION. Just use a normal variable. yes... menu.php <?php $id = "hello"; ?> and in other page <?php include "menu.php"; echo $id; ?> @include When a file is included, 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 Share on other sites More sharing options...
beyzad Posted November 27, 2007 Author Share Posted November 27, 2007 Thanks you dears. I used Lumio method and it's worked. thanks to Mr. Neon to. Quote Link to comment 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.