Hello,
I have a problem
I am trying to build my site multilangual and out of this reason i tried starting with cookies. I found a little tutorial how to use them, but as usual I seem to be too dumb to read proprely 😃.
Anyway what you should know, on my startup page i link the different languages with for example
<a href="index.php?lang=en">English</a>
And only start with PHP in the index file.
In the index.php I included the file "langcheck.php" on top which does the following:
<?PHP
//This file is checking the selected language of a user to output the website in the right language
if(!isset($cookie_language)) {
if(!isset($_GET['lang'])) {
$lang = en;
echo "<font color=\"red\"><strong><center>You did not select your language. By default the website is shown in english now.
<br><br>
You can change your language <a href=\"http://www.lh-web.com/lhdev\">here</a>.</center></strong></font>";
} else {
$lang = $_GET['lang'];
setcookie(cookie_language, [$lang]);
}
} else {
$lang = $cookie_language;
}
?>
Ok now this is the first time I do something similar like this, out of this reason I would be very glad for help, probably you guys see tons of errors, but you know,...N00bs 😛
Hoping to hear from you and thanks a lot in advance
Max