+ 5
Can we use same cookie in two different pages ?
4 Antworten
+ 20
OK, well, seeing that nobody is answering, this is a link that may be useful.
http://stackoverflow.com/questions/13330324/same-cookie-on-different-pages-cookie-path
+ 17
I don't know, but this interests me. 🍪
Let's await a good input on this question.
+ 11
@Jibin Sebastian
In the same domain?
Different domains?
Need more info to help you?
setcookie(name,value,expire,path,domain,secure,httponly);
[Edit]
Setting new cookie
=============================
<?php
setcookie("name","value",time()+$int,"/", "Sololearn.com");
/*name is your cookie's name
value is cookie's value
$int is time of cookie expires
"/" is the path of cookie
Sololearn.com is domain of cookie */
?>
Getting Cookie
=============================
<?php
echo $_COOKIE["your cookie name"];
?>
Updating Cookie
=============================
<?php
setcookie("color","red");
echo $_COOKIE["color"];
/*color is red*/
/* your codes and functions*/
setcookie("color","blue");
echo $_COOKIE["color"];
/*new color is blue*/
?>
Deleting Cookie
==============================
<?php
unset($_COOKIE["yourcookie"]);
/*Or*/
setcookie("yourcookie","yourvalue",time()-1);
/*it expired so it's deleted*/
?>
+ 2
following I'd like that answer as well