My website is language independent, I have several language packs that I include based on user selection.
User selection form:
<form action='' method='POST'>
<select name='language' onchange='this.form.submit();'>
<optgroup>
<option>Language</option>
<option value='eng'>English</option>
<option value='esp'>Español</option>
<option value='fra'>Français</option>
</optgroup>
</select>
</form>
The Script:
$language = $_POST['language'];
if($language == "esp")
include("languages/esp.php");
else if($language == "fra")
include("languages/fra.php");
else
include("languages/eng.php");
The problem is, when I click on a new page on the site, the chosen language is once again forgotten and loads the default English. I know I should be using cookies or sessions to keep the chosen language saved so all pages load that language pack. But how?