This question already has an answer here:
- Post the checkboxes that are unchecked 36 answers
I was trying to update my product status. Suppose if the product has stored as feature_product then it will appear in view. Now if i uncheck the input box it should return 0 but it always return 1. How to i set value of input box as 0 if it's uncheck?
@if($product->feature_product == 1)
<fieldset>
<div class="form-group">
<label class="col-sm-3 control-label "></label>
<div class="col-sm-9">
<label style=" padding-top: 0;" class="checkbox">
<span class="icons"><span class="first-icon fa fa-square-o"></span><span class="second-icon fa fa-check-square-o"></span></span>
<input type="checkbox" checked name="feature_product" data-toggle="checkbox"> Feature Product
</label>
</div>
</div>
</fieldset>
@endif
Controller part for getting the value:
$product->feature_product = Input::get('feature_product')?: 0;
Aucun commentaire:
Enregistrer un commentaire