mercredi 22 mars 2017

save checkbox values to database in mysql

I am working on a project in which i have to save the values of checkbox into database. for eg:- if we checked on checkbox then it's current status should be saved in databse here is my code

 <?php
                    //get rows query
                    $query = $db->query("SELECT * FROM bankstatement");
                    if($query->num_rows > 0){ 
                    $i=0;
                        while($row = $query->fetch_assoc()){
                        ?>
                         <form action="" method="post" enctype="multipart/form-data">
                         <tr>
                            <td><?php echo $row['cdate']; ?></td>
                            <td><?php echo $row['particulars']; ?></td>
                            <td><?php echo $row['reference']; ?></td>
                            <td><?php echo $row['deposits']; ?></td>
                            <td><?php echo $row['withdrawals']; ?></td>
                            <td><?php echo $row['bankname']; ?></td>
                            <td><?php echo $row['status']; ?></td>
                            <td><input type="checkbox" name="ch[$i++]"/><label for="reconcile bank stmt"></label></td>
                        </tr>
                     </form>
                    <?php } }else{ ?>
                    <tr><td colspan="8">No record(s) found.....</td></tr>
                    <?php } ?>

Now please suggest me thaqt how can i do this?? Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire