yup still a jr, at least for the next 6 months, than ill be a medium jr LOL...

alright, seriously, i need this thing done, so if you guys have any hints, pointers, would be appreciated.

it's probly not complicated for you guys, but i'm trying to write a language switcher.
so far it works, it change all the text on the web site for the langugage selected.

but ... it doesnt keep $_SESSION value accros pages, it look like its resetting every time you change page. thought $_SESSION was a superglobal and was keeping info for all the time connected to the site. hmm... or maybe its the form that resubmit null on page refresh and onload and $_SESSION reset. I feel like a dog chasing his own tail.

here's my code so far: (this php file is include, in the head of all the content pages, which affect the child pages, header, nav, sidebar, footer)


$_SESSION['lang'] = $_POST['test'];

    case 'en':
    case 'fr':
        echo 'FAILED';

now, maybe i miss understood $_SESSION or the form is screwing with my mind or my general construction is going in the ditch.

oh yeah limitations, the client, boss, guy always have special request, dont they. he want the language switcher to be transparent, so i cant pass the variable into the URI, thats why i was using superglobals. so index.php looks like the original site, even if it's english or french, or whateva language he will make me add in the future. i cant use cookies, because most of his users have cookies deactivated.

my last idea is a noob one, but what if i keep the var in a txt file and recreate what $_SESSION is supposed to do, at least what i thought he could do. - create file, add var, change var on $_POST, destroy txt file on exit -

any comments, hints, ideas would be nice.

ill go get somemore coffee and check that form idea i had while typing this
(to check if its the form screwing around with my code)

thx guys


yup the form reset to null, ill check if i can filter that.

but, still if you guys worked on i18n standard, lets me know how you did it.



hmmm... after much reading and testing, its not really the form cause isset filters that.

ive search somemore, and $_SESSION var are passed by cookies or by PHPSESSID like a GET from page to page.

so ... does this mean i cant do the job he's asking me ? (because of the limitation he asked)
smells like an april fool, that jerk!

anyways, i'll try to implement that txt file idea to keep the var.
just in case he was serious, ill see on monday

if you guys have any better idea, let me know.


Dark (LOL nice talking to myself, i should do that more often :P )

To keep a lang setting in a session seems OK for a session duration, to store it as a preference, put it into a database or a file. But back to your problem: do you have anywhere in your script(s) the session_start() command? It is required on every page for sessions to work.

yes i had session_start() on every pages in the head.

<!-- <?php session_start(); include('lang/validate.php'); ?> //-->

nop, no db access, he really put some weird limitations.

but, it's all good. i've implement the txt file solution and works fine.
can't wait to meet the guy on monday, just to know if it was a joke, pulling the leg on the new jr

thx for the reply bro