Welcome Guest, Not a member yet? Register   Sign In
pass two values from checkbox
#3

(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[]".

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!
$nocs $this->input->post('noc'); 
$result arrray();
foreach (
$certids as $index=>$certid) {
 
  $result[] = $certid '_' $nocs[$index];
}
echo 
'<pre>';
print_r($result);  //this will show the list of 1_1, 2_1 etc. 
echo '</pre>'
thanks a lot.its working perfectly.
Reply


Messages In This Thread
pass two values from checkbox - by kvanaraj - 09-01-2018, 05:10 AM
RE: pass two values from checkbox - by Wouter60 - 09-01-2018, 08:15 AM
RE: pass two values from checkbox - by kvanaraj - 09-02-2018, 01:16 AM
RE: pass two values from checkbox - by InsiteFX - 09-02-2018, 04:00 AM



Theme © iAndrew 2016 - Forum software by © MyBB