![]() |
Big problem with arrays and checkboxes - 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: Big problem with arrays and checkboxes (/showthread.php?tid=3587) |
Big problem with arrays and checkboxes - El Forum - 10-11-2007 [eluser]Référencement Google[/eluser] Hi, I am facing a big problem to repopulate checkboxes group from a DB. Here are the situations: - The checkbox group can be empty the first time, because we have to add the user selection to the DB - The checkboxes can be selected according to the DB, for exemple in a editing case - Finally, we have to keep the choice of the user while posting the form for validation. So here is my actual code: Code: function DB_checkBoxes($data, $fieldName, $values = array()) Code explaination: $data is an array containing all the checkboxes $fieldName is the name of the input, in my casse it will be for exemple choices[] $values is the array coming from the DB with the checked checkboxes that was saved by the user I don't know if somebody can help me, really I tryed almost all day about that and can't find the solution! |