如果用户在提交时选中复选框,如何在编辑页面中显示选中的复选框


How to show checkbox selected in edit page if user select the checkbox on submit

>我有一个复选框简单表单,有两个文件,提交时我在数据库中提交值是或否,现在在编辑中我想显示选中的复选框。

<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>

如何在编辑页面上显示预填充的复选框?

试试

<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>