views:

38

answers:

2

I created 3 language packs for my site: English, Spanish and French. I am just having trouble implementing them based on user selection. I have the following drop down menu:

<select onchange='document.location.href=this.options[this.selectedIndex].value;'>
  <option>Select</option>
  <option value="?lang=eng">US English</option>
  <option value="?lang=esp">Español</option>
    <option value="?lang=fra">Français</option>
</select>

How can I include the language files based on what the user selects, I just don't know what to put as the condition in the if statement.

Thanks.

+2  A: 

As you're bringing in the option via a query string, you can access it with

$lang = $_GET['lang']
adam
Just a note: you'd probably have to do a little more work in the actual application, such as validate the value and make it English by default. But I suppose that's not part of the OP's question so +1.
musicfreak
A: 
Dor