Sub menu in included page PART 2

Hello.
I v build a page loghead.php with sub-menu and i include the selected pages there.

switch($_GET['l'])
{
 case "man":
  $l = "login/main.php";
  break;
 
 case "reg":
  $l = "login/register.php";
  break;
........etc.........
and my sub-menu.
 <li><a href="index.php?p=loghead&l=man">Info</a></li>
 <li><a href="index.php?p=loghead&l=reg" >Register</a></li>

I m trying to include one more page
<li><a href="index.php?p=loghead&l=userinfo" >User Info</a></li>
 but when i try in my switch

case "userinfo":
  $l = "login/userinfo.php?user=$session->username";
  break;

the page is not included.

Any idea???
NTGrEAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

elodisCommented:

Im not sure if i completely understand what you're asking, but have you tried placing the session variable outsite of the quotes, i.e:

case "userinfo":
  $l = "login/userinfo.php?user=" . $session->username;
  break;


Where are you using your $l variable?  Is it working for your first two switch examples?
0
smaccariCommented:
Maybe because you try to add some parameters (user=...)?
The included userinfo.php, as it will be included in the page, can reach variables declared in your page. It can even reach $session->username, so why do you want to pass this as a parameter?

0
NTGrEAuthor Commented:
Hi..elodis
1) Yes the first 2 examples working
2)Iv try your code but i geting the same errors as before.
Warning: main(login/userinfo.php?user=tester) [function.main]: failed to open stream: No such file or directory in C:\Program Files\xampp\htdocs\login\loghead.php on line 54

Warning: main() [function.include]: Failed opening 'login/userinfo.php?user=tester' for inclusion (include_path='.;C:\Program Files\xampp\php\pear\') in C:\Program Files\xampp\htdocs\login\loghead.php on line 54

where tester=my login Name & line 54 where i include the pages..
<td align="center"><? include($l); ?></td>

Hi smaccari ..
I m trying to build (modify)a page where registered users can see infos about the acount...
thats why i need the ?user=$session->username
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

elodisCommented:
what does a direct browser call to ../login/userinfo.php?user=tester result in?
0
elodisCommented:
sorry...

./

i.e. wherever the page it actually sitting
0
NTGrEAuthor Commented:
Sorry i dont understand the question... :((

0
elodisCommented:

what happens when you call the page you're trying to include?

From the php errors it looks as if the page doesn't exist - or php doesn't think so anyway.

I was curious what adirect call you your userinfo.php page resulted...

ie

www.yourewebsite.com/login/userinfo.php?user=tester

0
NTGrEAuthor Commented:
Hmmmm....
strange...
Fatal error: Call to a member function usernameTaken() on a non-object in C:\Program Files\xampp\htdocs\login\userinfo.php on line 23

where line 23 is
$req_user = trim($_GET['user']);
if(!$req_user || strlen($req_user) == 0 ||
   !eregi("^([0-9a-z])+$", $req_user) ||
   !$database->usernameTaken($req_user)){ <<-----------------------------This !!!!!!
   die("Username not registered");
}

I dont get it...
0
smaccariCommented:
What i try to say to you is: as your userinfo.php is included in the main page, you don't have to pass parameters into the querystring, as the userinfo.php will access the same variables you have in the page.
So, in your userinfo.php, just replace this:

$req_user = trim($_GET['user']);

by this:

$req_user = $session->username;
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NTGrEAuthor Commented:
Thnx again smaccari !!!
Working perfect...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.