Itโs strange. Sessions should last quite a while. Try checking your code for random session_destroy () s.
If this does not work, try using cookies:
setcookie(name, value, expire);
So, to set a cookie variable in PHP, you would just use
<?php setcookie("MyCookie", "MyValue", time()+60*60*24); ?>
The expire value is in seconds. Using the code above, you can set a cookie called "MyCookie" with a value of "MyValue" and continue for 24 hours.
To get the value of this cookie, you can use
<?php print($_COOKIE['MyValue']); ?>
Please note that cookies MUST be set before the tag is called.
If the cookies do not work either, perhaps this is a problem with your php.ini. Can you publish your php.ini if โโthe cookies do not work?
Hope this helps!
source share