Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
code in controller
public function deleteMultiple(Request $request)
    {

       $delids = $request->input('delids');
       $delids = explode(",", $delids);

      // Category::whereIn('id',explode(",",$ids))->delete();
       foreach($delids as $id){
       DB::table('members')->whereIn('id',$id)->get()->delete();
       }

      return redirect('members')->with('success', 'Data Deleted Successfully');

   }




code in webpage
the html code for checkbox
<input type="checkbox" id="chkbox{{$number}}" class="checkboxall filled-in chk-col-red" name="delids" value="{{$row->id}}">


the delete button code

<form method="POST" action="{{url('deleteMultiple', $delids)}}" >
							  {{method_field('DELETE')}}
							  {{csrf_field()}}
							 <button type="submit" id="deleteTrigger" class="btn btn-danger" onclick="return confirm('Are you sure you want to delete this?');">Delete Selected</button><br><br>
							</form>


What I have tried:

request you to help me. I tried but getting errors

Undefined variable: delids (View: C:\wamp64\www\CPM\resources\views\admin\display_members.blade.php)


cannot use PUT, DELETE etc..
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900