Multiple Checkbox Saving in MySQL? - 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: Multiple Checkbox Saving in MySQL? (/showthread.php?tid=52984) |
Multiple Checkbox Saving in MySQL? - El Forum - 07-05-2012 [eluser]dhall[/eluser] I have an array that I pass from Controller to View to create a list of checkbox options for the User. Here is the view: Code: echo form_label('Secondary Activities:').br(1); How do I take the selected options and save them into a database table to then allow for reposting once saved? Sorry, I am new to all this stuff. Multiple Checkbox Saving in MySQL? - El Forum - 07-05-2012 [eluser]heavyman1[/eluser] Code: $data = array( You can use this to give each field name. So you can get the its value, by submitting the form. Code: $newsletter = $this->input->post('newsletter'); try to echo the var $newsletter to make u easier to understand Multiple Checkbox Saving in MySQL? - El Forum - 07-05-2012 [eluser]dhall[/eluser] My array consists of 17 options, which is dynamically generated when pulled from another database table. I don't think I could do that for all 17, and then having it be dynamic should the options change. Multiple Checkbox Saving in MySQL? - El Forum - 07-05-2012 [eluser]heavyman1[/eluser] I've never tried. But I believe you can use []. May be http://stackoverflow.com/questions/8902292/passing-dynamically-created-form-fields-to-php will help |