I have this td inside table tag with form method post:
<td><input type="checkbox" class="isProper" name="is_proper[]" value="V" /></td>
<td><input type="checkbox" class="notProper" name="is_proper[]" value="X" /></td>
User can checked only one checkbox per row, and I want to save checked value - "V" / "X".
In controller I have:
public function update(Request $request)
{
$oper_id = $request->oper_id;
$comment = $request->comment;
$rescoring = $request->rescoring;
$isproper = $request->is_proper;
foreach($oper_id as $key => $value){
$finalcontrol = Finalcontrol::find($value);
$finalcontrol->comment = $comment[$key];
$finalcontrol->rescoring = $rescoring[$key];
$finalcontrol->isproper = $isproper[$key];
$finalcontrol->save();
return redirect()->back()->with('success','Saved');
}
The thing is that controller save only the first row records to DB The problem started when I added this two of checkbox tag, before that all the records of all rows was saved corectly . Someone can please tell me what I am doing wrong about the checkboxes?
Aucun commentaire:
Enregistrer un commentaire