I have a Login form with Array as a success result.
If User input right credentials, then the system will have output like this :
Array ( [error] => false
[name] => admin
[email] => [email protected]
[apiKey] => e96d4538f1dea6b0bc16468e10191336
[status] =>actived
[createdAt] => 2014-11-08 16:31:14 )
How to save each array value into $_SESSION like this ?
$_SESSION['name'] = $Name;
$_SESSION['apiKey'] = $apiKey;
etc..
How to do it ?
What's the best approach? Thanks for any help :)
$_SESSION = array_merge($_SESSION, $yourArray);could work.$_SESSION['login'] = $that_array;will group them under$_SESSION['login']['name'], $_SESSION['login']['apikey']etc...