dimanche 2 février 2020

Edit previous record in the checkbox with php

I have a problem to edit previous record by checkbox in php.My problem is when I press the edit button,all can show me previous info record,but only in the checkbox unable to show me the previous record. Below is my coding:

Checkbox html:


    <div class="form-group col-lg-6">
                        <label class="control-label col-lg-4">Pricing<span style="color:red;">&nbsp;</span></label>
                        <div class="col-lg-8">
                    <input type="checkbox" name="rm_option" id="rm_option" value="1"><strong> RM </strong></input>&nbsp;&nbsp;&nbsp;
                        <input type="checkbox" name="point_option" id="point_option" value="1"><strong> Full Point </strong></input>&nbsp;&nbsp;&nbsp;
                        <input type="checkbox" name="partial_option" id="partial_option" value="1"><strong> Partial Point + RM </strong></input>


                        </div>
                        </div>

Checkbox echo edit function:

<?php
$sql = "select * from promotion_list where id=" . $_GET['id'];
$arr_sql = db_conn_select($sql);
foreach ($arr_sql as $rs_sql) {
    foreach ($rs_sql as $key => $value) {
        ?>
                                $("#<?php echo $key ?>").val("<?php echo $value ?>");
        <?php
    }
    ?>
                            $("#filter_id").val('<?php echo $rs_sql['id'] ?>');
                            $("#promotion_content").jqteVal('<?php echo $rs_sql['promotion_content'] ?>');
                            $("#promotion_terms").jqteVal('<?php echo $rs_sql['promotion_terms'] ?>');
                            $("#promotion_instruction").jqteVal('<?php echo $rs_sql['promotion_instruction'] ?>');
                            $("#promotion_policy").jqteVal('<?php echo $rs_sql['promotion_policy'] ?>');
                            $("#rm_option").jqteVal('<?php echo $rs_sql['rm_option'] == 1:'checked':'' ?>');
                            $("#point_option").jqteVal('<?php echo $rs_sql['point_option'] == 1:'checked':'' ?>');
                            $("#partial_option").jqteVal('<?php echo $rs_sql['partial_option'] == 1:'checked':'' ?>');
    <?php
}
?>

I think should be my these coding problem (in the below coding), because these function cannot work to let me show the previous record in the checkbox, anyone can guide me how to solve it? Thanks.

$("#rm_option").jqteVal('<?php echo $rs_sql['rm_option'] == 1:'checked':'' ?>');
                            $("#point_option").jqteVal('<?php echo $rs_sql['point_option'] == 1:'checked':'' ?>');
                            $("#partial_option").jqteVal('<?php echo $rs_sql['partial_option'] == 1:'checked':'' ?>');

Below is my output only the checkbox unable to show the previous the tick record:

Output




Aucun commentaire:

Enregistrer un commentaire