RE: [PHP-DB] SESSION

From: Date: Tue, 24 Dec 2002 02:43:30 +0000
Subject: RE: [PHP-DB] SESSION
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-24357@lists.php.net to get a copy of this message
> After collecting the input data from a FORM via an array (name=kgkeys) > the next function starts: > <?php > session_start(); > $_SESSION['g_numprimarykeys'] = $_POST['numprimarykeys']; //This always > works ok first time through > $_SESSION['g_kgkeys'] = $_POST['kgkeys']; //This always works ok first > time through > /* An alternative to the above: > if ( $action == "edit" ) Where is $action coming from? Should it be $_POST['action'] ?? > { > $_SESSION['g_numprimarykeys'] = $_POST['numprimarykeys']; // This > always fails - perhaps the block places it out of scope? > $_SESSION['g_kgkeys'] = $_POST['kgkeys']; // This always fails - > perhaps the block places it out of scope? > } > */ > switch ($action) > { > case "add": > include "./kgadd.php"; > break; > case "edit": > include "./kgedit.php"; > break; > ------------------------------------------------------------------- > Next file: > <?php > session_start(); > > include("kgstyle.php"); > include("Database.php"); > > $temp = 'g_kgkeys'; > foreach ($_SESSION[${temp}] as $key => $val) //This works ok when the > above stores 'g_kgkeys' properly. > { > $pkey[$key] = $val; > } > -------------------------------------------------------------------- > In php.ini: > register_globals = Off > > Question: When including $_SESSION['g_kgkeys'] = $_POST['kgkeys']; > within a block i.e. {}, should it function the same as outside the block > i.e. outside {}? > > Your help would be appreciated. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/

« previous php.db (#24357) next »