mardi 27 février 2018

undefined offset in laravel

Here am getting offset while one of the checkbox gets unchecked,here is the checkbox list

<input type="checkbox" id="day_off_1" name="day_off[]" checked  value="1" class="switch-input day_off">
<input type="checkbox" id="day_off_2" name="day_off[]" checked  value="1" class="switch-input day_off">
<input type="checkbox" id="day_off_3" name="day_off[]" checked  value="1" class="switch-input day_off">

Here is my controller code

$off = (!empty(Input::get('day_off'))) ? Input::get('day_off') : 0;

i tried to use isset in place of !empty but not getting allowed to use that,here if checked i want the value 1 to be stored otherwise 0




Aucun commentaire:

Enregistrer un commentaire