php - How do you append for example ?lang=en_US to the url based on a cookie containing country code? -


I have code that removes the country code saved in the cookie code.

  if (isset ($ _COOKIE ['country'])) {$ country = $ _COOKIE ['country']; $ Language = "eng"; If ($ country == "no") {$ language = "no"; }} And {$ language = "eng"; }  

Now I need to attach the language to $ supported_labeles = array ('en_US', 'no_NO');

And add it to the URL, it looks like this http: //localhost/site/test.php? Lang = no_NO

How do I do this?

  header ('location: http: //localhost/site/test.php? Lang = '. $ Language);  

or

echo & lt; Script & gt; Location. Href = "http: //localhost/site/test.php? Lang = '. $ Language'" & lt; / Script & gt;

Comments