1

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>
ekad
  • 14,436
  • 26
  • 44
  • 46
Nakul23
  • 57
  • 2
  • 9
  • First, your input elements need a name attribute, otherwise you won't be able to access them in PHP. This should help with the other part: [How to get form input array into PHP array](https://stackoverflow.com/questions/3314567/how-to-get-form-input-array-into-php-array) – FirstOne Nov 25 '17 at 12:45
  • ok...then how do i do query...to storing db for each group??? – Nakul23 Nov 25 '17 at 12:47
  • 1
    Well, that link already helps you with _reading_ each value, then that's with you. Loop the values an make them suit your database structure. You need to try something first and then come here with a specific problem. This is too broad. – FirstOne Nov 25 '17 at 12:53

0 Answers0