CodeIgniter Forums
How can i do autopostback with form_select or form_radio - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: How can i do autopostback with form_select or form_radio (/showthread.php?tid=62610)



How can i do autopostback with form_select or form_radio - hikaru2838 - 08-04-2015

Hi everyone, i'm started to learn php and codeigniter so i hope you can help me? Example, value of form_select or form_radio load from database and i want when i choose or select and other radio or select will change


RE: How can i do autopostback with form_select or form_radio - Avenirer - 08-04-2015

There is no form_select (none that I know of...)

Assuming you have a form select named status, and this status has 3 or more statuses, you write something like this:

form_dropdown('status', $statuses, set_select('status', $database_value), 'class="form-control"');

...where $statuses are the options (as array) $database_value is the value you take from your database. The same goes with the radio button.

The best thing is you have a great manual on this subject on the codeigniter site: http://www.codeigniter.com/user_guide/helpers/form_helper.html