note 16801 deleted from function.session-start by jimw

From: Date: Fri, 07 Dec 2001 20:29:34 +0000
Subject: note 16801 deleted from function.session-start by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-21929@lists.php.net to get a copy of this message
You are all declaring: ---------------------- session01.php ---------------------- <?php session_start(); ... ?> ---------------------- session02.php ---------------------- <?php session_start(); ... ?> I have found it NECESSARY to redeclare session_name() as follows: ---------------------- session01.php ---------------------- <?php session_name("Foo"); session_start(); ... ?> ---------------------- session02.php ---------------------- <?php session_name("Foo"); session_start(); ... ?> I give you the case of session01.php whose form calls session02.php. In session02.php, I include session02.inc to display an image when session02.php?display=1 <?php if(!$displayimage) { //display html text and <img src="session02.php?display=1"> //somewhere on the page }else{ include ("session02.inc");//display just the image } ?> I found by the school of hard knocks that you need both: session_name("Foo"); session_start(); I had to declare session_name and session_start in session01.php session02.php AND session02.inc to pass data correctly. If not session02.php?display=1 received nothing, even if it could spit back the session_id, even if it was included in session02.php. I made the mistake of believing because session02.php?display=1 was receiving data that session02.php received.

« previous php.notes (#21929) next »