This is a demonstration of setting and using cookies in PHP. In many circumstances, the build in session handlers (or extended session handlers of frameworks such as CodeIgniter) will be more appropriate ... and they use cookies internally ... but if you want a long term memory, or a setting shared between web applications on your domain, you may wish to use cookies directly - possibly in ADDITION to sessions!

Here are a few of my favourite things

Raindrops on roses
Whiskers on kittens
Cold cotton mittens

Change your favourite colour to ... whitegreenredbluetealorangebrown
We've used a cookie in this demonstration to save and re-use your selected background colour, even if you use other pages before coming back here. Due to the demonstration nature of this page, we've set a one hour timeout, but we would expect that in production use you would use much longer - perhaps years!

Training sample © 2023, WELL HOUSE CONSULTANTS LTD
This is
See source code here • More examples - same topic here
Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
Phone: +44 (0) 1225 708 225 • EMAIL: • WEB: