Sessions and header-redirect

From: Date: Fri, 20 Apr 2001 20:36:45 +0000
Subject: Sessions and header-redirect
Groups: php.general 
Request: Send a blank email to php-general+get-49596@lists.php.net to get a copy of this message
Does anyone know of a way to use sessions and still be able to redirect with the header function. In the code below I test for the existence of the PHPSESSID and send the user to register if it doesn't exist. If it does exist I start a session to retrieve the session variables then call a class that tests for other conditions. If the test is successful then I try to redirect which fails because (as I understand it) session_start has already sent headers. I really don't like putting links on pages that say "Click here to continue" so I'm looking for a solution. Any ideas? <? if (!isset($PHPSESSID)){ header("Location:http://www.blah.com/register.php"); } session_start(); if ($action == "update"){ include("../includes/update_class.php"); $my=new update_listing(); header("Location:http://www.blah.com mem_welcome.php?sid=$PHPSESSID"); } ?> JS Plauche

« previous php.general (#49596) next »