How can I obtain the same cookie value for different pages of a website that are not associated with each other? For example, a website has several unrelated pages in the same directory: 1.php, 2.php, and 3.php.
A user accesses 1. php and generates a cookie:
Setcookie ('mycookie1', $ c1 );
Setcookie ('mycookie2', $ c2 );
Setcookie ('mycookie3', $ c3 );
If the user clicks a hyperlink from another website to enter 2.php, the cookie value set in 1.php cannot be read in 2.php.
If I create a hyperlink in 1. php to connect to 3.php and access 3.php from 1. php, the cookie value set in 1. php will be displayed on 3. php:
2. php and 3. php have the same code:
$ C0 = $ _ COOKIE ['mycookie1'];
$ Cc2 = $ _ COOKIE ['mycookie2'];
$ Cc3 = $ _ COOKIE ['mycookie3'];
Echo $ PC3;
Echo $ cc2;
Echo $ cc3;
How can I read the cookie value set in 1.php on the 3. php page that is fully associated with 1.php?
Reply to discussion (solution)
Set the expiration time of cookie variables