Click to See Complete Forum and Search --> : POST to SESSION


HomoErectus
03-15-2008, 06:02 AM
Is there an easy way to import my POST variables into a SESSION?

aj_nsc
03-15-2008, 08:28 AM
$_session = $_post???

or, perhaps if you have a lot of them


foreach ($_POST as $key => $value) {
$_session[$key] = $value;
}

bokeh
03-15-2008, 11:40 AM
$_session = $_post???

or, perhaps if you have a lot of them


foreach ($_POST as $key => $value) {
$_session[$key] = $value;
}
How secure is that!!!

Huevoos
03-15-2008, 05:21 PM
$allowedvars = Array(
'var1',
'var2'
);
foreach ($_POST as $key => $value) {
if(in_array($key, $allowedvars))
$_session[$key] = $value;
}

;) A little bit more control over that

Znupi
03-16-2008, 02:15 PM
Maybe
$_SESSION['POST'] = $_POST;
So that it doesn't overwrite other stuff in $_SESSION?