PHP $_SESSION dissappear after visiting 2 pages, strangest thing

Hi all.
The strangest thing has happened to me while coding.

My sessions work on my own local server, but it does not quite work on the server i bought.
The strange thing is that some of my sessions work completely fine, while others dont.

I am building a site with a cart for storing items, now some of my code looks like this:


$_SESSION[“cart”] = array();
$_SESSION[“cart”][$_SESSION[“i”]] = $nummer;

$_SESSION[“type”] = array();
$_SESSION[“type”][$_SESSION[“i”]] = $type;


If i try to print “$_SESSION[“cart”][$_SESSION[“i”]];”

everything works just fine,
but if i try to print “$_SESSION[“type”][$_SESSION[“i”]];”

it only works on the next page, but if i go to a third page, it is like if the $_SESSION[“type”] never existed.

I did have some trouble with the charset migrating to the server i purchased, but i think i have fixed it all.
The problem does not appear on my local server:
PHP Version 5.3.3-1ubuntu9.3

but it does on my purchased server:
PHP Version 5.2.14

any help would be much appreciated.

Be sure you included session_start(); on the top of every page.

this sounds like, you forgot one page.

Sponsor our Newsletter | Privacy Policy | Terms of Service