mpempas Posted August 7, 2009 Share Posted August 7, 2009 I need an expert help, i have a drop-down select box and i would like to change language from here. The code is working but the problem is: 1. When im changing language english is still the first in the drop-down box and i cant change back to english, so when change a language the defualt one would be the one im using. 2. If there is any way do not change website to ?locale=en/el just refresh and active this language. Im using $_SESSION['langSYS'] <form name='language_switcher' method='post'> <select name="language" id="language" onChange="location.href('?locale='+this.value)"> <option value="en">English</option> <option value="el">Ελληνικά</option> </select></form> thank you Quote Link to comment https://forums.phpfreaks.com/topic/169266-solved-drop-down-box-language-change/ Share on other sites More sharing options...
The Little Guy Posted August 7, 2009 Share Posted August 7, 2009 The problem is, is that you are not using selected="selected" <form name='language_switcher' method='post'> <select name="language" id="language" onChange="location.href('?locale='+this.value)"> <option value="en"<?php echo ($_SESSION['langSYS'] == 'en')?' selected="selected"':'';?>>English</option> <option value="el"<?php echo ($_SESSION['langSYS'] == 'el')?' selected="selected"':'';?>>Ελληνικά</option> </select> </form> Quote Link to comment https://forums.phpfreaks.com/topic/169266-solved-drop-down-box-language-change/#findComment-893221 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.