have 4 wordpress installations on my site all stored in a separate folder by language, now I am making a index file in the main directory that has a form where they select a language in a dropdown menu, so if they submit the language I want to store it ‘I guess in SESSION’ with php, so that if they visit the main directory again in the future they don’t have to select the language again but they get redirected to the /en, /nl,.. index page.
I’m not very familiar with php so can anyone explain how to do this please?
thank you
<?php
SESSION_START();
if (isset($_GET['en'])) {
header( 'Location: http://www.mysite.com/en/' ) ;
}
else if (isset($_GET['nl'])) {
header( 'Location: http://www.mysite.com/nl/' ) ;
}
else if (isset($_GET['de'])) {
header( 'Location: http://www.mysite.com/de/' ) ;
}
else if (isset($_GET['tr'])) {
header( 'Location: http://www.mysite.com/tr/' ) ;
}
else {
header( 'Location: http://www.mysite.com/' ) ;
}
?>
i tried adding this to the beginning of the page with php include and then also using it for the form action but it always returns to the index page
My html:
<form name='language' action='language.php' method='get'>
<select>
<option value='en'>English</option>
<option value='nl'>Nederlands</option>
<option value='de'>Deutsch</option>
<option value='tr'>Turkçe</option>
</select>
<input type='submit' value='Submit'><br/>
</form>
When the user visits the page from which the language is selected, you check if they’ve already selected a language with something like this: