Jump to content

[SOLVED] Inlcude() issues


NerdConcepts

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.