Localhost session_id problem
Hello
I am running PHP off localhost on my home computer and putting a shopping cart together.
The code below sets the session_id OK but when I change from page1.php to page2.php, the session_id number is changed when it should stay the same.
Is there a setting for session cookies in a PHP config file on the local machine that needs changing?
Thanks.
Hello
I am running PHP off localhost on my home computer and putting a shopping cart together.
The code below sets the session_id OK but when I change from page1.php to page2.php, the session_id number is changed when it should stay the same.
Is there a setting for session cookies in a PHP config file on the local machine that needs changing?
Thanks.
Code:
function gettheid(){if (isset($_COOKIE["theshoppingcartdemoid"])){return $_COOKIE["theshoppingcartdemoid"];}else{session_start();
setcookie("theshoppingcartdemoid", session_id(), time() + 3600 * 24 *30, "/", "",0);return session_id();}}