NerdConcepts Posted July 26, 2007 Share Posted July 26, 2007 I am trying to do include("theme/menu.php?index"); what this would do it run the menu.php page and because ?index is there the menu.php page would recognize that the $_GET['index'] is set and then generate the code for the index menu. This also works with $_GET['section'] and $_GET['project']. Since there is going to be 3 different menus, but the top and bottom of all those menus are the same and it saves on number of PHP pages, I saw fit to just make one menu file. Except well as we all know or, like me, seem to find out; PHP will not let you run a $_GET when including a file. Is there a way to by pass this or another way I can pass the information to the menu.php page. For testing I'm using a $_SESSION['MENU'] = 'index'; variable but I hate to have to keep doing that. Or is that my only hope to get this to work? Link to comment https://forums.phpfreaks.com/topic/61807-solved-inlcude-issues/ Share on other sites More sharing options...
redarrow Posted July 26, 2007 Share Posted July 26, 2007 use functions() on a page and call the function's and place them where needed. this way you use one include() statement then use the function() name and place the function anywere. Link to comment https://forums.phpfreaks.com/topic/61807-solved-inlcude-issues/#findComment-307795 Share on other sites More sharing options...
NerdConcepts Posted July 26, 2007 Author Share Posted July 26, 2007 So you saying to use the session method but write a function for it? right? so basically the function for the index menu would be: function menuIndex () { $_SESSION['MENU'] = 'index'; include("theme/menu.php") } Am I getting what you said correctly? Link to comment https://forums.phpfreaks.com/topic/61807-solved-inlcude-issues/#findComment-307816 Share on other sites More sharing options...
redarrow Posted July 26, 2007 Share Posted July 26, 2007 yep make sure each page what has the function has session_start() on ok. Link to comment https://forums.phpfreaks.com/topic/61807-solved-inlcude-issues/#findComment-307821 Share on other sites More sharing options...
rameshfaj Posted July 26, 2007 Share Posted July 26, 2007 If u donot want to use the session then for the variables need to be passed from the previous page to the next page. If u want to go to the third page then the values posted cannot be recognized and used. For only two pages order u can use the fields like hidden. Ex: <input type=hidden,name=something,value='1'> On other page u can do: $value_posted=$_POST['something']; This generates error if u go directly to the second page so use this $value_posted=@$_POST['something'];//$_GET not used due to security reasons. Link to comment https://forums.phpfreaks.com/topic/61807-solved-inlcude-issues/#findComment-307893 Share on other sites More sharing options...
NerdConcepts Posted July 26, 2007 Author Share Posted July 26, 2007 Thanks a bunch. I'll play with both and see what I like the best. Btw, how is using $_GET with include() a security issue? Link to comment https://forums.phpfreaks.com/topic/61807-solved-inlcude-issues/#findComment-308169 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.