Tuesday, 10 September 2013

Initialise Language Selection

Initialise Language Selection

I'm trying to get a simple language initialisation working, below are the
clauses. Have a missed any possible situations where a user wouldn't have
either a default language set or a selected language set?!
If lang is POSTed the assign it to the $_SESSION
If lang is not POSTed the see if $_SESSION doesn't exist and assign default
Otherwise do nothing as $_SESSION is already set with selected language
and populated.
if(isset($_POST['lang'])) { $_SESSION['lang'] = $_POST['lang']; } else {
if(!isset($_SESSION['lang'])) { $_SESSION['lang'] = 'en_uk'; } }

No comments:

Post a Comment