Add values of Dynamic rows in the Database

0

Ihavethistableabove,andIhavetheaddbuttontoaddarowtothistable,asintheimagebelow.

Iwouldliketoknowifyoucansavethisnewdatafromtherowaddedinthedatabase

Followmycodethataddstheline

<script>$("#adicionar").bind( "click", function() {
                var $tbody = $("#calculaTotal > tbody" );
                var $tr = $tbody.children( "tr:first" ).clone();

                $tr.each( function() { 
                    $( this ).find( "input" ).val( "newimput" );
                });

                $tbody.append( $tr );



            });
        </script>

and this is the code for my table

   <table id="calculaTotal" class="table table-bordered" style="border:2px   solid">

       <thead>
      <tr> 
    <th style="border:2px solid">Preço R$</th>
    <th style="border:2px solid">Quantidade </td></th>   
<th style="border:2px solid">Descrição</th>
<th style="border:2px solid">Codigo</th>

</tr>
</thead>




<tbody >
<tr  style="border:2px solid">
 <td style="border:2px solid"><input type="number" name="preco"id="preco"/>   </td>
 <td style="border:2px solid"><input type="number"  name="quantidade"  id="quantidade"/></td>


 <td style="border:2px solid">

<select id="desc" class="selecter" data-live-search="true" name="descr">

 <?php 
 $dados =mysqli_query($connect,"SELECT * FROM produtos");

 while($exibe = mysqli_fetch_array($dados)) { ?>
 <option name="desc" value="<?php echo $exibe['Descricao'] ?>"><?php echo    $exibe['Descricao'] ?></option>
 <?php } ?>

 </select>
 </td>



 <td style="border:2px solid">

 <select id="cod" name="codi">
 <option name="selecione">-</option>
 <?php 
  $dados =mysqli_query($connect,"SELECT * FROM produtos ");

  while($exibe = mysqli_fetch_array($dados)) { ?>
 <option name="Cod"  value="<?php echo $exibe['Codigo'] ?>"><?php echo     $exibe['Codigo'] ?></option>
 <?php } ?>

</select>


</td>

</tr>

</tbody>


<label for="">Selecione um Cliente</label><br/>
<select id="cliente" class="form-control"  >
<?php

 $dados2 =mysqli_query($connect,"SELECT * FROM clientes");
 while($cliente=mysqli_fetch_array($dados2)){ ?>

 <option data-codigo="" name="Cliente" id="cliente" value="<?php echo   $cliente['Cliente'] ?>"><?php echo $cliente['Cliente'] ?></option>
  <?php }?>

  </select>






 </table>
    
asked by anonymous 07.05.2017 / 22:31

0 answers