Reputation: 9
I have a check box simple form with two fileds, on submit I am submitting the values yes or no in the database, now in edit I want to show that checkbox selected.
<div class="form-group col-md-6">
<label> Is Paid</label></br>
Yes <input type="checkbox"
name="paid"
value="yes"
value=" <?php echo $row_cat['is_paid']; ?>"
/>
No <input type='checkbox' name="paid" value="no" />
</div>
How can I show prefilled checkbox on edit page ?
Upvotes: 0
Views: 1922
Reputation: 1028
Try
<div class="form-group col-md-6">
<label> Is Paid</label></br>
Yes <input type="checkbox"
name="paid"
value="yes"
<?php echo $row_cat['is_paid']=='yes'?' checked="checked" ':''; ?>
/>
No <input type='checkbox'
name="paid"
value="no"
<?php echo $row_cat['is_paid']=='no'?' checked="checked" ':''; ?>
/>
</div>
Upvotes: 1