Save dynamically created fields in MYSQL databse

Save dynamically created fields in MYSQL databse

Dear All

I want to save fields that are created dynamically


  1.  <table width="100%" class="table table-bordered" id='invoicetable'>
  2.         <thead>
  3.           <tr>
  4.             <th width="5%"><h4 align="center">NO</h4></th>
  5.             <th width="50%">
  6.               <h4>Perticuler
  7.                 <label for="numberofrows"></label>
  8.                 <input name="numberofrows" type="text" id="numberofrows" value="1" />
  9.               </h4>            </th>
  10.             <th width="15%">
  11.               <h4 align="center">Hrs/Qty</h4>            </th>
  12.             <th width="15%">
  13.               <h4 align="center">Rate/Price</h4>        </th>
  14.             <th width="15%">
  15.               <h4 align="center">Sub Total</h4>            </th>
  16.             <th width="15%"><input type="button" value="Add Fild" id='addfield' class="AddButton" ></th>
  17.  
  18.           </tr>
  19.         </thead>
  20.         <tbody>
  21.           <tr>
  22.             <td><div align="center">1</div></td>
  23.             <td><input name="particular1" type="text" id="particular1" class="particular"></td>
  24.             <td class="text-right"><div align="center"><input name="qty1" type="text" id="qty1" class="qty" value="0.00"></div></td>
  25.             <td class="text-right"><div align="center"><input name="rate1" type="text" id="rate1" class='rate' value="0.00"></div></td>
  26.             <td class="text-right"><div align="center"><input name="subtotal1" type="text" id="subtotal1" class='subtotal' value="0.00"></div></td>
  27.             <td class="text-right">&nbsp;</td>
  28.           </tr>
  29.           </tbody>
  30.       </table>
AddButton creates a row using following Jquerry

  1. $(document).ready(function() {
  2.    $(".AddButton").live("click", function(e) {
  3.      var rowCount = $('#invoicetable tr').length;

  4.    var numberofrows=$('#numberofrows').val();
  5.   // alert(numberofrows);
  6.    var numberofrows = parseInt(numberofrows)  + 1;
  7.   // alert(numberofrows);
  8.    $('#numberofrows').val(numberofrows);

  9. //   alert('aa'+rowCount);
  10. $("#invoicetable > tbody").append('<tr> <td><div align="center">'+rowCount+'</div></td> <td><input name="particular'+rowCount+' type="text" id="particular'+rowCount+'" class="particular" ></td> <td class="text-right"><div align="center"><input name="qty'+rowCount+' type="text" id="qty'+rowCount+'" class="qty" value="0.00"></td> <td class="text-right"><div align="center"><input name="rate'+rowCount+' type="text" id="rate'+rowCount+'" class="rate" value="0.00"></div></td> <td class="text-right"><div align="center"><input name="subtotal'+rowCount+' type="text" id="subtotal'+rowCount+'" class="subtotal" value="0.00"></div></td><td></td> </tr>');    
  11.    $('#invoicetable > tbody:last').append(newRow); 
  12.   
  13. });
In short I am creating following fields dynamically using jquery given above


particula2
particula3
particula4


qty2
qty3
qty4

 
rate2
rate3
rate4

However when i click Submit to save records
I am unable to save these fields

I tried 
  1. echo "<br>part >> ".$_POST['particular2'].'   '.$_POST['particular3'].'      '.$_POST['particular4'];
  2. echo "<br>qty 234 >>".$_POST['qty2'].'   '.$_POST['qty3'].'      '.$_POST['qty4'];
  3. echo "<br> rate 234 ".$_POST['rate2'].'   '.$_POST['rate3'].'      '.$_POST['rate4'];
  4. echo "<br> sunbtotal ".$_POST['subtotal2'].'   '.$_POST['subtotal3'].'      '.$_POST['subtotal4'];
But nothing was stored in the fields