Re: $_SESSION var sometimes set, sometimes not

From: Date: Tue, 25 Nov 2003 03:05:22 +0000
Subject: Re: $_SESSION var sometimes set, sometimes not
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-170842@lists.php.net to get a copy of this message
Anthony Whipple wrote:
The following code sometimes produces output indicating that the session variables have been set, and sometimes is says that they have not been set. Unfortunately the server is not mine to configure, but if there is a problem with it, I can get in touch with the right people. Is the script properly written? Is it a server problem? <html> <head> <title>Test stuff...</title> </head> <body> <?php session_start(); // enable session level global variables
This shouldn't work at all. You need to have session_start() before any HTML or output. The beginning of your file should be <?php session_start(); ?> <html> ... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com

« previous php.general (#170842) next »