Re: An easier way? $_POST[] => $_SESSION[]

From: Date: Mon, 01 Nov 2004 18:14:00 +0000
Subject: Re: An easier way? $_POST[] => $_SESSION[]
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-200852@lists.php.net to get a copy of this message
Erich Kolb wrote:
Is there an easier way to assign all post data from a form to session data? $_SESSION['first_name'] = $_POST['first_name']; $_SESSION['last_name'] = $_POST['last_name']; $_SESSION['email'] = $_POST['email'];
If a two-dimensional array is ok for you then the easiest way is this: $_SESSION['user'] = $_POST; Then you have: $_SESSION['user']['first_name']; $_SESSION['user']['last_name']; $_SESSION['user']['email']; But you also have something like $_SESSION['user']['submit']; because the submit button in also copied from _POST to the session. -- Bye, K <http://www.ailis.de/~k/> (FidoNet: 2:240/2188.18) [A735 47EC D87B 1F15 C1E9 53D3 AA03 6173 A723 E391] (Finger k@ailis.de to get public key)

Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
« previous php.general (#200852) next »