07 Feb, 2007
Store all post variables/values in a session
Posted by: Jennifer In: Script snippet|Scripts
This is one of those things I use all the time but because I can't remember things like this, I always have to look for the exact code to do it…
This will take all the values submitted in a form and store them in a session:
foreach($_POST as $k=>$v) {
$_SESSION[$k]=$v;
}
And when you're ready to dump the session values…
session_unset();// reset session array
session_destroy(); // destroy session.