CodeIgniter Forums
Selected Option from a drop down list passed to controller with post - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Selected Option from a drop down list passed to controller with post (/showthread.php?tid=55709)



Selected Option from a drop down list passed to controller with post - El Forum - 11-07-2012

[eluser]GabrieleMartino[/eluser]
Hi,

I would like to know if there is a way to pass data to a function in a controller that is not the id of the field but the selected item text.

Thanks


Selected Option from a drop down list passed to controller with post - El Forum - 11-07-2012

[eluser]boltsabre[/eluser]
PHP will only pass the value of an input (mapped to the inputs name) via the $_POST variable.

If you need the id, the class, the text of a select option, the value of an attribute (ie, width or height), etc, you'll need to pass it via AJAX.