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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx to get public key)

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux