I have the $user array that contains data with special characters. It seems like each element of $user that contains special characters can't render properly after they are stored in a session.
Here is my code:
<?php
session_start();
include_once('../application/classes/DataLayer.class.php');
$dl = new DataLayer();
$user = $dl->doLogin($_POST['email_sub'], $_POST['password_sub']);
if(isset($user)) {
foreach($user as $detail_array => $detail){
$fn = html_entity_decode($user['fn']);
$ln = html_entity_decode($user['ln']);
}
var_dump($fn, $ln); // $fn and $ln display well here
$_SESSION['user'] = $user;
$_SESSION['fn'] = $fn;
$_SESSION['ln'] = $ln;
var_dump($_SESSION['fn'], $_SESSION['ln']); // $_SESSION['fn'], $_SESSION['ln'] display well here too
}
else {
//do something here
}
?>
Any help would be appreciated. Sorry for my bad english.