This is a discussion on Re: [PHP] Passing Objects between scripts and guarateeing thata language has been choosen. within the PHP General forums, part of the PHP Programming Forums category; [snip] How can I guarantee that a language is always choosen? I mean how is this done professionally? What do ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
[snip]
How can I guarantee that a language is always choosen? I mean how is this done professionally? What do I have to write at the beginning of every page? [/snip] You have a bunch of options. on each page you could add something like this to everypage: if (!isset($_SESSION['language'])){ header("Location: pick_language.php"); } This will make sure you have a language chosen on each page to set the language sessions variable you could use something like this: $_SESSION['language'] = $_POST['language']; You could set a permanent cookie (be careful because some users block cookies) once the user picks a language, then use that cookie to set a session variable. This would be helpful is someone bookmarked the page, something like this: if (isset($_COOKIE['language'])) { $_SESSION['language'] = $_COOKIE['language']; } but there is many more ways to do this. I would try a bunch of differnet things just to see how things work. |