freakstyling Posted March 14, 2012 Share Posted March 14, 2012 Hi guys! Having problems with my switching between languages. It gives a ´Notice: Undefined index: lang on line 22. This is the script... <?php session_start(); $_rootPath = dirname(__FILE__); // Root path per als includes / require's $_version = 22; // Versió de la pàgina, força que s'hagin de recarregar les imatges que estiguin en cache. $_lang = 'es'; $_availableLanguages = array('es', 'en'); // Idiomes disponibles $_picturesMediaPath = "pictures/"; require_once($_rootPath . '/lib/db.php'); require_once($_rootPath . '/lib/lang.utils.php'); if( isset($_GET['l']) && languageIsAvailable($_GET['l']) ) { $_lang = $_GET['lang']; $_SESSION['lang'] = $_lang; } else if( isset($_SESSION['lang']) ) { $_lang = $_SESSION['lang']; } else { $l = getPreferredUserLanguage(); if($l) $_lang = $l; } // Clear cache Header("Cache-control: private, no-cache"); Header("Expires: Mon, 26 Jun 1997 05:00:00 GMT"); Header("Pragma: no-cache"); ?> Thank you in advance!!! Laurens Link to comment https://forums.phpfreaks.com/topic/258904-i-get-a-notice-undefined-index-lang-when-i-try-to-change-language/ Share on other sites More sharing options...
scootstah Posted March 14, 2012 Share Posted March 14, 2012 I can only imagine that this if( isset($_GET['l']) && languageIsAvailable($_GET['l']) ) is supposed to be this if( isset($_GET['lang']) && languageIsAvailable($_GET['lang']) ) Link to comment https://forums.phpfreaks.com/topic/258904-i-get-a-notice-undefined-index-lang-when-i-try-to-change-language/#findComment-1327297 Share on other sites More sharing options...
freakstyling Posted March 14, 2012 Author Share Posted March 14, 2012 OMG, always the same... looking for that tiny thing all morning, couldn´t find anything. Thank you very much, now I don´t get the notice anymore!!! YEEEHAAA Link to comment https://forums.phpfreaks.com/topic/258904-i-get-a-notice-undefined-index-lang-when-i-try-to-change-language/#findComment-1327299 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.