Hi,
Ive created a listbox that allows the user to select whether they would like to view to the the site in English or Spanish.
This listbox exists in an include file which controls the overall style of each page. I have managed to get the listbox to work by using the following code:
echo("<form name='langselect' action=$PHP_SELF>");
echo("Select Language: ");
echo("<select name='lang' >");
echo("<option value='English' selected>English</option>");
echo("<option value='Spanish'>Spanish </option>");
echo("</select>");
echo("<input type='submit' name='Go' value='Go' >");
Now this refreshes the page and the url becomes - http://www.something.com/index.php?lang=Spanish&Go=Go
I can then grab the value of $lang from the url using $HTTP_GET_VARS['lang'] and use it to display the correct content for that page in the language chosen.
However, some pages already pass variables through the url and when the user selects a different language for that page then those variables are overwritten.
i.e. a url such as http://www.something.com/index.php?var=2
becomes
http://www.something.com/index.php?lang=Spanish&Go=Go
Is there a way to append the $lang variable to the url instead of overwriting existing variables?
Should i be storing the $lang as a session variable instead? (i am having header problems)
Your help is greatly appreciated.