+ 5

Can we use same cookie in two different pages ?

1st Apr 2017, 3:54 AM
Jibin Sebastian
Jibin Sebastian - avatar
4 Answers
+ 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
1st Apr 2017, 4:48 AM
Hatsy Rei
Hatsy Rei - avatar
+ 17
I don't know, but this interests me. đŸȘ Let's await a good input on this question.
1st Apr 2017, 4:14 AM
Hatsy Rei
Hatsy Rei - avatar
+ 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*/ ?>
1st Apr 2017, 6:49 AM
Cory GutierrezđŸ”č
Cory GutierrezđŸ”č - avatar
+ 2
following I'd like that answer as well
1st Apr 2017, 4:37 AM
Josh Smith
Josh Smith - avatar