mardi 4 avril 2017

How to keep the selected checkboxes checked while pagination?

new to Laravel. Using 5.3 and loving it. Having a problem with my checkboxes while pagination. I want to keep the selected checkboxes checked while pagination. Is there any way using 'appends' or 'session' or something else. Codes until now is provided below.

Form with a chekcbox:

        @foreach($cforms as $candidates)                 

        <tr>  

        <td>

        <input type="checkbox" name="checkbox" value= "" >

        </td>

        <td></td>

        <td><img src="/uploads/cimage/"   style="width:200px;height:200px;"></td>

        <td></td> 

        <td></td>

        <td></td>

        <td></td>

        <td></td>

        </tr>

        @endforeach

      </table></br>



     @endunless 

Candidates Form Controller:

class cviewcontroller extends Controller {public function cpview(){

$candidates = DB::table('cforms')

              ->where('position', 'President')

              ->paginate(5); 

return view('cform.cpview', ['cforms' => $candidates]);
}

}

Let me know if I have to provide anything else. Any help would be greatly appreciated. Thank you.




Aucun commentaire:

Enregistrer un commentaire