I have two buttons to change my language in my site.. i am getting the full url with
$myurl = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
And my two buttons:
echo '<a href="'.$myurl.'?lang=en"><img src="http://www.example.com/site/flags/en.png" name="English" title="English" alt="" width="40" height="40" border="0" ></a>';
echo '<a href="'.$myurl.'?lang=de"><img src="http://www.example.com/site/flags/de.png" name="German" title="German" alt="" width="40" height="40" border="0" ></a>';
So far it's working great... So if press the first button my url (in my url bar) will be
http://www.example.com/site/?lang=en
Now if i echo this "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
I am getting http://www.example.com/site/index.php
and in my url bar i can see
http://www.example.com/site/?lang=en
Does anybody know why i can't "grab" the ?lang=en?
I also tried the code bellow but without luck....
if ($string == "http://www.example.com/site/index.php" || $string == "http://www.example.com/site/" || $string == "http://www.example.com/site/?lang=en" || $string == "http://www.example.com/site/index.php?lang=en"){
echo "ENGLISH";
}else{
echo "DE";
}