title: Clone Table Row With PHP Data Select Box
body: <p>I am newbie in php as well as bootstrap. I am trying to create master-detail form to receive product from supplier. I had somehow manage to build the format but have difficulties on cloning table row with php select box. My HTML codes are below ...</p>
  
  <pre><code>&lt;div class="form-group"&gt;
      &lt;div class='row'&gt;
          &lt;div class='col-xs-1 col-sm-1 col-md-1 col-lg-1'&gt; &lt;/div&gt;
          &lt;div class='col-xs-10 col-sm-10 col-md-10 col-lg-10'&gt;
              &lt;table class="table table-bordered table-hover" id="table-data"&gt;
                  &lt;thead&gt;
                      &lt;tr&gt;
                          &lt;th width="2%"&gt;&lt;input id="check_all" class="formcontrol" type="checkbox"/&gt;&lt;/th&gt;
                          &lt;th width="38%"&gt;Parts Name&lt;/th&gt;
                          &lt;th width="15%"&gt;Price&lt;/th&gt;
                          &lt;th width="15%"&gt;Quantity&lt;/th&gt;
                          &lt;th width="15%"&gt;Total&lt;/th&gt;
                      &lt;/tr&gt;
                  &lt;/thead&gt;
                  &lt;tbody&gt;
                      &lt;tr id="id1" class="tr_clone"&gt;
                          &lt;td&gt;&lt;input class="case" type="checkbox"/&gt;&lt;/td&gt;
                          &lt;td&gt;
                              &lt;div class="dropdown"&gt;
                              &lt;select data-type="partsCode" name="partsNo[]" id="partsNo1" class="form-control"&gt;
                              &lt;?php
                              $query = "SELECT PARTS_ID, PARTS_NAME FROM parts_info ORDER BY PARTS_NAME";
                              if ($result = mysqli_query($con, $query))
                              {
                                  while ($row = mysqli_fetch_array($result))
                                  {
                                  ?&gt;
                                      &lt;option value=&lt;?php echo $row['PARTS_ID']; if ($shopid == $row['PARTS_ID']) echo " selected"; ?&gt;&gt; &lt;?php echo $row['PARTS_NAME']; ?&gt; &lt;/option&gt;
                                  &lt;?php
                                  }
                              }
                              mysqli_free_result($result);
                              ?&gt;
                              &lt;/select&gt;
                              &lt;/div&gt;
                          &lt;/td&gt;
                          &lt;td&gt;&lt;input type="number" name="price[]" id="price1" class="form-control changesNo" onkeypress="return IsNumeric(event);" ondrop="return false;" onpaste="return false;"&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;input type="number" name="quantity[]" id="quantity1" class="form-control changesNo" onkeypress="return IsNumeric(event);" ondrop="return false;" onpaste="return false;"&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;input type="number" name="total[]" id="total1" class="form-control totalLinePrice" onkeypress="return IsNumeric(event);" ondrop="return false;" onpaste="return false;"&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/tbody&gt;
              &lt;/table&gt;
          &lt;/div&gt;
          &lt;div class='col-xs-1 col-sm-1 col-md-1 col-lg-1'&gt; &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class='row'&gt;
          &lt;div class='col-xs-1 col-sm-1 col-md-1 col-lg-1'&gt; &lt;/div&gt;
          &lt;div class='col-xs-12 col-sm-3 col-md-3 col-lg-3'&gt;
              &lt;button class="btn btn-danger" type="button"&gt;- Delete&lt;/button&gt;
              &lt;button class="btn btn-success" type="button"&gt;+ Add More&lt;/button&gt;
          &lt;/div&gt;
          &lt;div class='col-md-3 col-md-offset-4'&gt;
              &lt;button class="btn btn-primary btn-block" id="button" type="submit" name="submit" value="Submit"&gt;Save&lt;/button&gt;
          &lt;/div&gt;
          &lt;div class='col-xs-1 col-sm-1 col-md-1 col-lg-1'&gt; &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Please anyone can solve my issue will be greatfull. I need to dynamically Add and Remove Row with this two buttons.
  Also if anyone have any reference on how to make master-detail form in php with bootstrap will support me well. Thank you in Advance.</p>
  
  <p>To get a concept please check the following URL. I want to add Parts Name to Total as a new row when I press + Add More. Please note that the Parts Name comes from MySQL through PHP code ... </p>
  
  <p>jsfiddle.net/imranctgbd/34djbLLn</p>