mercredi 29 août 2018

How can I make a checkbox checked or not checked depending on what the value is in the database

So, I have this in my edit.blade.php

<div class="form-check disabled">
    <label class="form-check-label">
        <input class="form-check-input" type="hidden" value='0' name="is_default">
        <input class="form-check-input" type="checkbox" value='1' name="is_default">
        Default Variant
    </label>
</div>

and I have an is_default column in my database which has the values of either 0 or 1 depending if the checkbox is checked or not.

Now, I want to create an edit page and I want to show if that if is_default value is 1 then the checkbox should be checked, else it will be unchecked.

the value of is_default is represented as value=""



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire