title: I want to get id of multiple checkboxes
body: <p>I want id of selected items from checkbox and insert to database. I can insert other items to database but id of selected checkbox is not inserting.</p>
  
  <pre><code>    &lt;div class="row" &gt;
        &lt;div class="col-xs-3"&gt;
        &lt;form action="itemad.php" method="post"&gt;
  
        &lt;div class="multiselect"&gt;
        &lt;input type="text" name="datepicker" id="datepicker" placeholder="Date"     &lt;/p&gt;
          &lt;b&gt;Select Menu:&lt;/b&gt;
            &lt;div class="checkbox" onclick="showCheckboxes()"&gt;
              &lt;select&gt;
                    &lt;option&gt;Select an option&lt;/option&gt;
             &lt;/select&gt;
           &lt;div class="overSelect"&gt;&lt;/div&gt;
          &lt;/div&gt;
  
       &lt;div id="checkboxes"&gt;
  
          &lt;?php
              include 'connection.php';
             $query="select item from item";
              $result=mysql_query("$query");
               while($row=mysql_fetch_array($result)):; 
                echo $row['item'];
                 for($i=0; $i&lt;=count('item'); $i++ ) 
          ?&gt;
        &lt;input type="checkbox" name="check_list[]" value="" &gt;&lt;/input&gt;&lt;br&gt;
             &lt;?php endwhile;?&gt; 
             &lt;/div&gt;
           &lt;input type="text" name="price" Placeholder="Pricee" minlength="1" &gt;&lt;br&gt;&lt;br&gt;
           &lt;input type="submit" name="submit"&gt;  
        &lt;/div&gt; 
       &lt;/div&gt;
            &lt;script type="text/javascript"&gt;
              var expanded = false;
              function showCheckboxes() {
                var checkboxes = document.getElementById("checkboxes");
                if (!expanded) 
                { 
                  checkboxes.style.display = "block";
                  expanded = true;
                } 
                else
                 {
                  checkboxes.style.display = "none";
                  expanded = false;
                 }
              }
            &lt;/script&gt;
    &lt;/form&gt;
    &lt;/div&gt;
    &lt;/div&gt;
  </code></pre>
  
  <h2>itemad.php:</h2>
  
  <pre><code>if(isset($_POST['submit']))
  {
  if(!empty($_POST['check_list'])) 
  {
      // Counting number of checked checkboxes.
      $checked_count = count($_POST['check_list']);
      echo "You have selected following ".$checked_count." option(s): &lt;br/&gt;";
      // Loop to store and display values of individual checked checkbox.
      foreach($_POST['check_list'] as $id) 
          {
              echo "&lt;p&gt;".$id ."&lt;/p&gt;";
          } }
  else
      { echo "&lt;b&gt;Please Select Atleast One Option.&lt;/b&gt;"; }
     $price=$_POST['price'];
          $date=$_POST['datepicker'];
          $query= "insert into menu(item,price,date) values('$id','$price','$date')";
         $result=mysql_query($query);
         echo "suucesful";
      }
  </code></pre>
  
  <blockquote>
    <p>i want to store id of each item in database. but in database i am not getting id for selected items. </p>
  </blockquote>