Hi,
Ok I have a slight problem with a multilingual website I am working on. There are links that allow the user to change languages throughout the site, this is the code:
<? if ($_SESSION["lang"]=="en") {
echo"<a href=\"".$_SERVER[PHP_SELF]."?".$_SERVER[QUERY_STRING]."&lang=fr\">";
} else if ($_SESSION["lang"]=="fr") {
echo"<a href=\"".$_SERVER[PHP_SELF]."?".$_SERVER[QUERY_STRING]."&lang=en\">";
} ?>
I needed to get both the current file being looked at and the querystring because it is a shopping cart and I am passing variables througout the url and I didn't want them to go off the current page when changing languages...so, if I keep pressing that, eventually I will end up with the following url:
index.php?section=product&tid=ha4dd&pid=1&lang=en&lang=fr&lang=en&lang=fr
See how &lang keeps repeating itself over and over, it's not that this causes the script to stop working, but it's bad to see it...
Is there anyway I keep stop this from happening if the user keeps changing languages without changing pages?
Cheers,
Chris