I have below mentioned code in JSP Page. I am able to save all the values from below text boxes to DB. However, I read each text box name in my servlet (request.getParameter()) to save the fields. Is it possible to improve this code? like for example : to save all the values of one particular column in an array and save to db. If yes; please show an example that helps me. Also how to ignore if a row is empty. for example, user fills only two rows and rest rows are empty. I want to save only first two rows in DB.


PHP Code:

<table class="cmn-table" id="t1" border="1" style="margin-left: 0.2em; margin-    right:0em">
 <
col width="5%">
   <
col width="18%">
   <
col width="18%">
   <
col width="18%">
   <
col width="18%">
   <
col width="18%">
  <
tr>    
   <
th>Sl.No</th>
   <
th>Source IP Address</th>
   <
th>Destination IP Address</th>
   <
th>Service and Port (TCPUDPetc.)</th>
   <
th>Start Date</th>
   <
th>Expiration Date</th>
   </
tr>
  <
tr>
  <
td style="align:center"</td>
 <
td><input type="text" name="name" id="name" size="20"> </td>
  <
td><input type="text" name="name1" id="name1" size="20"> </td>
  <
td><input type="text" name="name2" id="name2" size="20"> </td>
  <
td><input type="text" name="name3" id="name3" size="15"> <img src="../Image/cal.gif" id="" style="cursor: pointer;" onclick="javascript:NewCssCal('name3','MMddyyyy','dropdown',false,'12')" /></td>
  <
td><input type="text" name="name4" id="name4" size="15"><img src="../Image/cal.gif" id="" style="cursor: pointer;" onclick="javascript:NewCssCal('name4','MMddyyyy','dropdown',false,'12')" /> </td>
  </
tr>
   <
tr>
  <
td style="align:center"> <label</label> </td>
  <
td><input type="text" name="name5" id="name" size="20"> </td>
  <
td><input type="text" name="name6" id="name" size="20"> </td>
  <
td><input type="text" name="name7" id="name" size="20"> </td>
  <
td><input type="text" name="name8" id="name3" size="15"> <img src="../Image/cal.gif" id="" style="cursor: pointer;" onclick="javascript:NewCssCal('name3','MMddyyyy','dropdown',false,'12')" /></td>
  <
td><input type="text" name="name9" id="name4" size="15"><img src="../Image/cal.gif" id="" style="cursor: pointer;" onclick="javascript:NewCssCal('name4','MMddyyyy','dropdown',false,'12')" /> </td>
  </
tr>
   <
tr>
   <
td> <label</label> </td>
  <
td><input type="text" name="name10" id="name" size="20"> </td>
  <
td><input type="text" name="name11" id="name" size="20"> </td>
  <
td><input type="text" name="name12" id="name" size="20"> </td>
 <
td><input type="text" name="name13" id="name3" size="15"> <img src="../Image/cal.gif" id="" style="cursor: pointer;" onclick="javascript:NewCssCal('name3','MMddyyyy','dropdown',false,'12')" /></td>
  <
td><input type="text" name="name14" id="name4" size="15"><img src="../Image/cal.gif" id="" style="cursor: pointer;" onclick="javascript:NewCssCal('name4','MMddyyyy','dropdown',false,'12')" /> </td>
  </
tr>
   <
tr>
   <
td> <label></label> </td>
  <
td><input type="text" name="name15" id="name" size="20"> </td>
  <
td><input type="text" name="name16" id="name" size="20"> </td>
  <
td><input type="text" name="name17" id="name" size="20"> </td>
 <
td><input type="text" name="name18" id="name3" size="15"> <img src="../Image/cal.gif" id="" style="cursor: pointer;" onclick="javascript:NewCssCal('name3','MMddyyyy','dropdown',false,'12')" /></td>
  <
td><input type="text" name="name19" id="name4" size="15"><img src="../Image/cal.gif" id="" style="cursor: pointer;" onclick="javascript:NewCssCal('name4','MMddyyyy','dropdown',false,'12')" /> </td>
  </
tr>
     <
tr>
    <
td> <label></label> </td>
  <
td><input type="text" name="name20" id="name" size="20"> </td>
  <
td><input type="text" name="name21" id="name" size="20"> </td>
  <
td><input type="text" name="name22" id="name" size="20"> </td>
  <
td><input type="text" name="name23" id="name3" size="15"> <img src="../Image/cal.gif" id="" style="cursor: pointer;" onclick="javascript:NewCssCal('name3','MMddyyyy','dropdown',false,'12')" /></td>
  <
td><input type="text" name="name24" id="name4" size="15"><img src="../Image/cal.gif" id="" style="cursor: pointer;" onclick="javascript:NewCssCal('name4','MMddyyyy','dropdown',false,'12')" /> </td>
  </
tr>

</
table