PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
If an English speaking customer who resides in China visited the website, they would automatically be taken to the Chinese language version based on their IP address being identified as in China. However, they may wish to view the website in English.
My question is how do I override the redirection to page 1 if the customer wants to view the website in English?
Any help greatly appreciated and thanks in advance.
That's certainly an option to consider. However, I don't really want the customer to initially have to select their language. I want to be able to redirect automatically before the customer has to do anything based on the customer's location with an override option should the customer wish at that point to change the language.
I know that I will probably need to use sessions, but I don't really know how to go about it.
The customer doesn't have to specify a language. Do an extra check - if !isset($_GET['LANG']) then you don't assign a new value to $CountryName, you can keep whichever value you've previously worked out based on IP.
When setting the language (you first want to check for the override in the URL) -- then -- check to see if we have previously had it set, and if not, determine their location based on ip.