Re: Lost session variables still confounding me

From: Date: Thu, 04 Nov 2004 15:28:16 +0000
Subject: Re: Lost session variables still confounding me
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-201179@lists.php.net to get a copy of this message
Stuart Felenstein wrote:
--- Jason Wong <php-general@gremlins.biz> wrote:
Maybe what you had before was: if (count($myarray) > 5)
      $_SESSION['arrayerr'] = "you have selected
too many industries";
      session_write_close();
      header ("Location: Page2.php?".SID);
      exit;
And yes that has a totally different behaviour to the code with the "endif;" construct.
Yep, that is what I had. So, no parse error, but did not work right either. Stuart
So you just forgot some curly-braces then. You'd write either [code] if (count($myarray) > 5) {
    $_SESSION['arrayerr'] = "you have selected too many industries";
    session_write_close();
    header ("Location: Page2.php?".SID);
    exit;
} [/code] or [code] if (count($myarray) > 5):
    $_SESSION['arrayerr'] = "you have selected too many industries";
    session_write_close();
    header ("Location: Page2.php?".SID);
    exit;
endif; [/code] HTH, Daniel

« previous php.general (#201179) next »