pass two values from checkbox |
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)
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! (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.
Maybe this will help, check boxes and radio buttons have no meaning if empty ( un-checked ).
PHP: Get Values of Multiple Checked Checkboxes What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |