Jump to content

SESSION Problem


ktalebian

Recommended Posts

Hi there!

I am running WAMP on my computer, and I am getting an error:

I have two files, and one is included in the other:

 

page1.php
<?php
// doing stuff
$_SESSION["name" ] = "something";
include("url)" // url of page2.php
?>

page2.php
<?php
echo $_SESSION["name"];
?>

 

now, if the URL is in the format:

http://localhost/path_to_page2.php

, the $_SESSION["name"] becomes NULL in page2.php, and so I get nothing.

But, if the url is in the format:

page2.php or ../path_to_page2.php

then it works fine.

 

So that's ok, but then I get another problem.

If want to include the url in the formation:

page.php?page=stuff

then I have to use the

http://localhost/path_to_page2.php?page=stuff

 

otherwise it says file not found, and if I use http, then the $_SESSION does not work!

 

Help please! Why the hell is that happening?

 

I have session_start() at the beginning of both pages btw.

thanks!

Link to comment
https://forums.phpfreaks.com/topic/103933-session-problem/
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.