![]() |
[SOLVED] Get certain data from $_POST from a dinamic form - 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: [SOLVED] Get certain data from $_POST from a dinamic form (/showthread.php?tid=55262) |
[SOLVED] Get certain data from $_POST from a dinamic form - El Forum - 10-17-2012 [eluser]Juan Velandia[/eluser] Hello everyone, I would like to ask for your help. I have created a form created from records in a data base table named ITEMS The view: Code: echo form_open('item/print'); I check some of the check boxes that I want and send the form to the controller: The controller Code: $post = array(); The problem is that I need to put into the $post array ONLY the values $item->id_item of the selected items in the form, but I also get the SUBMIT value within the array What can I do, I dont want to use a if(!$key==submit) within the loop. Any ideas or previous thread will be highly appreciated! [SOLVED] Get certain data from $_POST from a dinamic form - El Forum - 10-17-2012 [eluser]noslen1[/eluser] Have you tried Code: echo form_submit('', 'Submit selected items'); [SOLVED] Get certain data from $_POST from a dinamic form - El Forum - 10-17-2012 [eluser]Juan Velandia[/eluser] Hello noslen1, That could do the trick, but it won`t work if I have have more fields on the form that I would like to use. I think it has to do with the name an id of each checkbox, but Im still dealing with it. Thanks a lot. [SOLVED] Get certain data from $_POST from a dinamic form - El Forum - 10-17-2012 [eluser]Juan Velandia[/eluser] I think I did it: view: Code: echo form_open('item/print'); controller: Code: $post = array(); [SOLVED] Get certain data from $_POST from a dinamic form - El Forum - 10-17-2012 [eluser]CroNiX[/eluser] so make your checkbox names an array, Code: <input type="checkbox" name="checkbox_array[<?php echo $item->id_item; ?>]" value="<?php echo $item->name_item; ?>" /> and then just use Code: $checkboxes = $this->input->post('checkbox_array'); PS - You shouldn't directly use the $_POST array... use input::post(). [SOLVED] Get certain data from $_POST from a dinamic form - El Forum - 10-17-2012 [eluser]Juan Velandia[/eluser] Thanks Cronix, I'll do it as you say |