samedi 25 novembre 2017

How do I insert database multiple checkbox value in a group wise in php

The form looks likeenter image description here

I want to create package which contains fixed no of GROUPS, and each group can contain n no of ITEMS. Here group 1 and group 2 items are different also id. Now users can checked any no of item from each group. then how do i create a package by saving in database.?

here is the group create code:

<div class="form-group" id="one">
  <label class="control-label col-sm-2" for="">Group 1:</label>
  <div class="col-sm-10">
    <div class="panel panel-default">
      <div class="panel-heading text-center">Select Items</div>
      <div class="panel-body">
        <div class="row">
           <?php        
              $sql = "SELECT *  FROM item ORDER BY name ASC";
              $result = $conn->query($sql);
              if ($result->num_rows > 0) {
                while($row = $result->fetch_assoc()) { ?>
              <div class="col-md-6 ">
                <div class="checkbox">
                  <label><input type="checkbox" value="<?php echo $row['id'];?>"><?php echo $row['name'];?></label>
                </div>
              </div>    
             <?php }}else {echo '<h2>Please wait We will Update Soon...</h2>';}?>
        </div>  
      </div>
    </div>
  </div>
</div>




Aucun commentaire:

Enregistrer un commentaire