Form with a foreach() and <select option> - 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: Form with a foreach() and <select option> (/showthread.php?tid=53491) |
Form with a foreach() and <select option> - El Forum - 07-26-2012 [eluser]Hana[/eluser] Hello everyone I am trying to create a PHP form. I did a query on a database (in my Model), and I display the results in the view with a foreach. Then, my user can choose which objects he wants to disable and which objects he wants to exclude from the list. My problem is I don't get How to create a table disable[] and exclude[] containing every line where "disable" is chosen and "exclude" is chosen. I'm lost :down: Here is my code (or what I'm trying...) Code: <?php After this, I am trying in my Controller to display each $item[0] value from disable[] and each $item[0] value from exclude[]. Then I will do a request on each objects to disable and another request on each objects to exclude, in the same fonction. (foreach exclude do this) (foreach disable do this) Code: $disable = (($_POST['DN'][] = 'disable')); If you have any ideas which could help me it would be great! I'm desperate and I found only simple form on the web... No tips on form like mine :o Thanks! :-) Edit: It seems I cannot do what I want with the "select option" component... Then, I could do this: On the left, checkbox and one button (input) "Disable selected objects". And on the right, another pool of checkbox and its button "Exclude selected objects". I don't want to use radiobutton because if the user clicks on the button it can't uncheck it anymore >_< So, I should try 1 form with 2 pool of checkboxes ? ^^ |