How do I show cookie value without reload the page?
I have a two page form. When I set a cookie with the following code:
<?php
if (isset($_POST["button"]) || isset($_POST["button_x"])) {
setcookie("cookTest", "".((isset($_POST["Entry"]))?$_POST["Entry"]:"") ."", time()+(60*60*24*30), "/", "", 0);
}
?>
I need to do a manually reload the 2nd page in order to show up the value.
When I use this code
<?php
if (isset($_POST["button"]) || isset($_POST["button_x"])) {
$_COOKIE['cookTest'] = ((isset($_POST["Entry"]))?$_POST["Entry"]:"");
setcookie("cookTest", "".((isset($_POST["Entry"]))?$_POST["Entry"]:"") ."", time()+(60*60*24*30), "/", "", 0);
}
?>
The cookies are set on the 2nd page but when I go back to the first page, I nedd again to reload the page manually. How can I avoid the manual reload on the first page?