Forum Moderators: coopster
First question is if this is a good idea or not. What I want to do is loop through my $_POST vars array and I would like each variable to be stored in a Session variable of the same name. Anything wrong with doing this?
Secondly Im not sure exactly how to code it as I am new to php.
I have something like:
foreach($HTTP_POST_VARS as $field_name=>$field_value){
$_SESSION['$field_name'] = $field_value;
}
Is that close? :)
Thanks for your help.
$attributes = array();
// fill post/get vars, GET overwrites POST
$attributes = array_merge($attributes,$HTTP_POST_VARS, $HTTP_GET_VARS); I don't pass it to session directly, but you could just as easily use it to load up everything into there.
$_REQUEST [php.net]
Variables provided to the script via the GET, POST, and COOKIE input mechanisms, and which therefore cannot be trusted. The presence and order of variable inclusion in this array is defined according to the PHP variables_order [php.net] configuration directive. This array has no direct analogue in versions of PHP prior to 4.1.0. See also import_request_variables() [us3.php.net].