Sub menu in included page PART 2

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

 case "man":
  $l = "login/main.php";
 case "reg":
  $l = "login/register.php";
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";

the page is not included.

Any idea???
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.


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;

Where are you using your $l variable?  Is it working for your first two switch examples?
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?

NTGrEAuthor Commented:
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
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.

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


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


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...


NTGrEAuthor Commented:
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...
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;

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...
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

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.