php multi language session -
I am trying for several hours but I can not understand it. I am trying to create a multi language site, and I have a form of changing language. Every time I change language, I need to reload the page twice to see results. Site structure is similar:
1: General. Php checks that the user is logged in, and store the language in a session variable
if ($ count = = 1) {while receiving ($ line = $ result-> gt; (PDO :: FETCH_ASSOC)) {$ _SESSION ['language'] = $ line ['language']; }}
2: Includes every page header.fp which will run the Set Language function setLanguage ($ _ session ['language'])
In general it is. Php
function set language ($ LAN) {if ($ lan == "english") {included ("languages / napp"); } Otherwise ($ lane == "tra_chinese") {included ("languages / tra_chinese.php"); } Other (Include ("Languages / NAPP"); 3}: change.php is a page that includes a form to change language. if (! ($ _ POST )) {$ Sql = "Set user update language` = ': language where' username '= = id =' $ result = $ db-> ready ($ sql); $ result- & gt; (Array (': language' = & gt; $ _ POST ['language'], ': id' = & gt; $ id)); $ _SESSION ['language'] = $ _POST ['language']; setLanguage ($ _ Session ['language']);}
It appears that I first Nguage.change can change when i change language.change Can someone teach me this how to fix this? Thanks!
Comments
Post a Comment