Re: Lost session variables still confounding me

From: Date: Thu, 04 Nov 2004 09:46:48 +0000
Subject: Re: Lost session variables still confounding me
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-201138@lists.php.net to get a copy of this message
Hello Stuart, Thursday, November 4, 2004, 9:38:44 AM, you wrote: SF> Page 2: SF> $_SESSION['f1a'] = $_POST['ListingName']; SF> Page 3: SF> if (count($myarray) > 5) { SF> $_SESSION['arrayerr'] = "you have selected too many SF> industries"; SF> header ("Location: Page2.php"); SF> exit; SF> } SF> If the validation above passes, no problem. But if it SF> doesn't, once it redirects, the session variable , f1a SF> is bye bye. Unless I'm mistaken - you are redirecting back to Page 2 upon an error, right? Well according to the code posted, the second you hit Page 2 again, you are over-writing whatever is in the f1a session variable with the contents of the $_POST var, which naturally will not exist, hence you'll blank it out every single time. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services "I am not young enough to know everything." - Oscar Wilde

« previous php.general (#201138) next »