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!
1. Title - You are missing a ; after the ]. Same goes with $HTTP_REFERER.
2. $lang['test_text'] - You are missing the entire <?php echo $lang['test_text']; ?>
Also... If you like, please check the last link in my signature (Passing Variables) for more info about using a form like yours.
Also, if this is the extent of your example, and you have full control over the languages available, it would be much simpler to write your language switcher like this, instead of the big if/else that you have:
if (!$lang) {
$lang = "en";
}
include "/lang/" . $lang . ".php";
That way it's all automated and you don't ever have to update it again. The disadvantage is that if $lang somehow gets set to something that there's not a corresponding file for, the user won't see any content.
Unipus wrote:
The disadvantage is that if $lang somehow gets set to something that there's not a corresponding file for, the user won't see any content.
Well put.
Tho, used with file_exists(), the $lang file wanted could be searched for, and if not found, display a default. There are endless ways with this type. =)