I have a website that uses language files for all the text and I want to have a default language and use a form to allow users to select a different language.
I want to store the selected or default language in a session variable.
The code I'm using is in the code section.
The outcome is that the site loads in the default language of english and the page changes to german if the german button is pressed but it changes back to english when you navigate to a different page.
I'm clearly going wrong but I have no idea where so your help is appreciated.
Code to set session variable:
$_SESSION['language'] = $_POST['language'];
$_SESSION['language'] = 'english';}
Form for user language selection:
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="submit" name="language" value="german" />
<input type="submit" name="language" value="english" />