vendredi 9 février 2018

get values of checked and unchecked in looping form

i have multiple insert query and i want to filtering if data checked it will inserting to my database, but if not checkid data cannot inserted, this my form:

$employee = 10;
$att_employee = 5;
<input type="hidden" name="att_employee" value="$att_employee" />
foreach ($employee as $emp){
<input type="text" name="field1[]" />
<input type="hidden" name="field2[]" value="0">
<input type="checkbox" name="field2[] value="1" />
}

in my controller

$data=array();
for($i=0; $i < $att_employee; $i++) { 
$data[$i] = array(
'field1'=> field1[$i],
'field2'=> field2[$i],
)
}

maybe i must create if condition in my controller but before to it i have some problem, my checkbox fields not return values




Aucun commentaire:

Enregistrer un commentaire