Just to be sure, PHP doesn't really care what browser the client is using. If the code works in Firefox, it'll work in IE--the difference in behaviour you are noticing is probably due to the fact that one the firefox PHP session['lang'] is set and the one for IE is not.
First off, I wouldn't recommend accessing the session scope directly--Use a facade that has some convenience functions to make your life easier.
Code: Select all
// Facade to Session scope
class Session {
public static function connect() {
session_start();
}
public static function get($variable, $defaultValue=NULL) {
return isset($_SESSION[$variable]) ? $_SESSION[$variable] : $defaultValue;
}
// Sets the session variable to defaultValue ONLY IF it is not already set.
public static function init($variable, $defaultValue) {
if(isset($_SESSION[$variable])) {
return $_SESSION[$variable];
} else {
$_SESSION[$variable] = $defaultValue;
return $_SESSION[$variable];
}
}
public static function set($variable, $value) {
$_SESSION[$variable] = $value;
}
public static function has($variable) {
return isset($_SESSION[$variable]) ;
}
public static function remove($variable) {
return unset($_SESSION[$variable]) ;
}
}
Note: I use a similar class called Param to access get and post variables via the $_REQUEST scope.
Code: Select all
require_once('./inc/vars.inc');
require_once('./inc/header.inc');
require_once('./php/paintBall.php');
require_once('Session.php');
require_once('Param.php');
Session::connect();
Session::init('lang', Param::get('lang', 'eng')); // Pretty neat, eh?
$paintBall = new paintBall();
If you wanted to use your code, do it like this:
Code: Select all
if(isset($_POST['lang'])) {
$_SESSION["lang"] = $_POST['lang'];
} elseif(!isset($_SESSION['lang'])) {
$_SESSION["lang"] = "eng";
}