note 34914 rejected from function.session-register by didou

From: Date: Mon, 11 Aug 2003 19:48:18 +0000
Subject: note 34914 rejected from function.session-register by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-53897@lists.php.net to get a copy of this message
Note Submitter: jarfil@jarfil.net ---- (PHP 4.2.2 Linux) I don't know if it's the intended behavior, but it took me a while to figure out that when I had session_start() inside one include and then tried to add $_SESSION elements from inside another include, they were not added and their values lost unless the elements were previously "initialised" inside the same include session_start() was. example: #main.php include('start.php'); include('set.php'); #start.php session_start(); #set.php $_SESSION['newvalue']="anything"; // this one works just like a normal non-registered variable solution: #start.php session_start(); if (!$_SESSION['newvalue']) $_SESSION['newvalue']="void";

« previous php.notes (#53897) next »