<form action="<?=base_url();?>cms/getCategoryByLang" method="POST"> <select name="language" onchange="this.form.submit()"> <?php foreach($language as $lang):?> <option value=<?=$lang[ 'language']?>> <?=$lang[ 'language']?> </option> <?php endforeach?> </select> </form>
The selected value is sent to the controller, where it returns the category by language and since this is all without ajaxa, the page reloads and the last value of $lang['language'] is displayed, not the selected one.
How to make it so that it displays not the last value, but the chosen one?