![]() |
get value of selected dropdown list???? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: get value of selected dropdown list???? (/showthread.php?tid=24595) Pages:
1
2
|
get value of selected dropdown list???? - El Forum - 11-13-2009 [eluser]amira_fcis[/eluser] how to get the value of selected text from dropdown list that user select from a view and i get it from the controller....here is the view Code: <h5>City*</h5> && here is the controller Code: // here i need to make echo for selected value of city dropdown list. thanks for help get value of selected dropdown list???? - El Forum - 11-13-2009 [eluser]CroNiX[/eluser] $selected_value = $this->input->post('city'); ?? get value of selected dropdown list???? - El Forum - 11-15-2009 [eluser]amira_fcis[/eluser] many thanks ,but what if i need the value of option like 1,2,3 depending on the selected item of course. Code: <option value="<? echo $ty['id'] ;?>"></option> get value of selected dropdown list???? - El Forum - 11-15-2009 [eluser]CroNiX[/eluser] Thats what my above posts gives you? get value of selected dropdown list???? - El Forum - 11-17-2009 [eluser]amira_fcis[/eluser] no this echo ids 1,2,3,.... i need values like London,Paris,.... get value of selected dropdown list???? - El Forum - 11-17-2009 [eluser]Cro_Crx[/eluser] If you need the names of the cities instead of the ID's then simply set the names of the values. Code: <option value="<? echo $ci['name'] ;?>"><? echo $ci['name'];?></option> get value of selected dropdown list???? - El Forum - 11-17-2009 [eluser]andrewtheandroid[/eluser] may i suggest storing $city as an array with $cities = array('id'=>'name'); Or if you need to store information other than name instead of name you could have an array $cities = array('id'=>array('name'=>'paris','location'=>'france','population'=>'lots')); Code: <? foreach($cities as $id => $city_name){> && here is the controller Code: // here i need to make echo for selected value of city dropdown list. get value of selected dropdown list???? - El Forum - 11-17-2009 [eluser]CI_avatar[/eluser] Code: $selected_value = $this->input->post('city'); is the correct one. please check the values of your array. get value of selected dropdown list???? - El Forum - 07-14-2012 [eluser]_Moat_[/eluser] i know this is an old topic but i have a problem where the post is not retrieving the value of the selected option. what i'm doing is: VIEW: Code: <select name="ID"> CONTROLLER: Code: $selected_Val = $this->input->post('ID'); the value of the $selected_Val= 0 and it never changes if the the option changed. get value of selected dropdown list???? - El Forum - 07-14-2012 [eluser]CroNiX[/eluser] How many times are you going to ask the exact same question and ignore the solutions? You are not using set_value() correctly. It requires at least one parameter, the field name to get the value of. |