Si ci stavo pensando grazie!
Un'altra domanda, ho fatto una prova ma non riesce a settare il cookie.
Nella pagina dell'hotel ho un link, con scritto salva hotel, che mi rimanda ad un'altra pagina, questa:
Codice PHP:
$hotelId = $_GET['hotelId'];
$hotelStars = $_GET['hotelStars'];
$hotelName = urldecode($_GET['hotelName']);
$listArray = array
(
array (
'id' => $hotelId,
'nome' => $hotelName,
'stelle' => $hotelStars,
)
);
$listJSON = json_encode($listArray);
setcookie('wishlist', $listJSON);
header("Location: {$_SERVER['HTTP_REFERER']}");
Ma quando ritorno alla pagina precedente e provo a stampare il cookie non stampa nulla:
Codice PHP:
if(isset($_COOKIE['wishlist'])) {
$listJSONdecode = json_decode($_COOKIE['wishlist']);
echo '<pre>';
print_r($listJSONdecode);
echo '<pre>';
}