How to create a simple PHP cookie language toggle?
I'm trying to set up, what I thought would be, a simple language switch. I thought I'd use PHP cookies, but they're not behaving as intended. I've read a few cookie tutorials and looked at a few similar examples here on StackOverflow, but I must be missing something because it can't get it to work properly. I'm setting the language by passing it as a URL variable (lang=en or lang=ru). That all seems to be fine. However, the code I have at the moment that sets the cookie seems to be one step behind, so initially it has no value (I'd like it to be 'en' by default), then if the user clicks the