It might be obvious, but I can't seem to understand it. So don't laugh.
Let's assume this scenario. My website has 5 themes, there are 5 buttons. Clicking each button changes theme respectively and uniquely. I use JavaScript to do that, so I set name of theme in a cookie, for example theme=DarkOne
and set it to expire over 10 years. My very local storage, saves that variable. Without knowledge of the server.
Visitor of my website decides to change his theme to theme=DarkOne
by clicking one of buttons. Then, goes off wondering visiting of the wonderful images and very informative, stuff... meanwhile reloading the address (by going to various sub-pages) about 80 times.
Then decides to scroll down the website, takes glance at the footer and notices You're visiting our website using: DarkOne. Issued by $_COOKIE["theme"]
from server-side PHP, my question is. How does the server know what the variable is set as? The JavaScript saved my variable on my personal local storage. PHP has never known my variables or any interaction with cookies.
Does Apache server request list of my cookies? I've been Googling the example HTTP requests, and have visited websites which show requests I send. But none of that appears on the request.
I realize that there's a thing called "cache". But it's content doesn't appear in HTTP headers.
Could someone shine some more light on this please?
No code can be provided, this isn't an error, nor malfunction. I'm just wondering how it works. And how it's possible.