SESSION

From: Date: Tue, 24 Dec 2002 02:35:05 +0000
Subject: SESSION
Groups: php.db 
Request: Send a blank email to php-db+get-24356@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" ) { $_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. Kevin Gordon

« previous php.db (#24356) next »