![]() |
pass two values from checkbox - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: pass two values from checkbox (/showthread.php?tid=71588) |
pass two values from checkbox - kvanaraj - 09-01-2018 I want to post of textvalue+checkbox value into the form <input type="checkbox"id="mycheck2" name="certid[]" value="2" class="cbx" > <input type="number" id="primaryincome2" min="0" max="999" name="noc"> I want to get the values like 1_1 2_1 3_1 4_2 the first value from checkbox and second value from textbox (no of copies) RE: pass two values from checkbox - Wouter60 - 09-01-2018 I think this is the 3rd thread where I'm trying to explain to you that form fields must have unique names or names that return values as an array, like certid[]. You must do the same with the element named "noc". Change that into "noc[]". Now, when you submit the form, be aware that only checked checkboxes are being posted, as well as input fields that are not disabled. I guess you only want a value of the input field, if the checkbox that belongs to it is checked, right? In your controller: PHP Code: $certids = $this->input->post('certid'); //here you leave the [ ] out! RE: pass two values from checkbox - kvanaraj - 09-02-2018 (09-01-2018, 08:15 AM)Wouter60 Wrote: I think this is the 3rd thread where I'm trying to explain to you that form fields must have unique names or names that return values as an array, like certid[]. You must do the same with the element named "noc". Change that into "noc[]".thanks a lot.its working perfectly. RE: pass two values from checkbox - InsiteFX - 09-02-2018 Maybe this will help, check boxes and radio buttons have no meaning if empty ( un-checked ). PHP: Get Values of Multiple Checked Checkboxes |