I'm very new in web programming, especially on Codeigniter. And now I'm looking for how to pass/submit array from view to controller.

This part of my HTML script in view:

```
<tr class="rowdim"> <!-- ROW 1 -->
<td><input type="text"  id="bookid1" name="book_id[]" /></td>
<td><input type="text"  id="qty1" name="qty[]" /></td>
<td><input type="text"  id="uom1" name="uom_id[]" /></td>
</tr>

<tr class="rowdim"> <!-- ROW 2 -->
<td><input type="text"  id="bookid2" name="book_id[]" /></td>
<td><input type="text"  id="qty2" name="qty[]" /></td>
<td><input type="text"  id="uom2" name="uom_id[]" /></td>
</tr>

<tr class="rowdim"> <!-- ROW 3 -->
<td><input type="text"  id="bookid3" name="book_id[]" /></td>
<td><input type="text"  id="qty3" name="qty[]" /></td>
<td><input type="text"  id="uom3" name="uom_id[]" /></td>
</tr>

```

My ajax:

```
var det_book = document.getElementsByName("book_id[]");
var det_qty = document.getElementsByName("qty[]");
var det_uom = document.getElementsByName("uom_id[]");
var vdata = {det_book:det_book,det_qty:det_qty,det_uom:det_uom}
$.ajax({
    type:"POST",
    url:"<?php echo base_url(); ?>trans/StockIn/saveData",
    data:vdata,
    success:function(returnmsg){
        if (returnmsg=='""'){
             window.alert(msg);
         } else {
             window.alert(returnmsg);
         }
});

```

Controller:

```
 $det_book=$_POST["det_book"];
 $det_qty=$_POST["det_qty"];
 $det_uom=$_POST["det_uom"];
 $details = array();
 $index=0;
 foreach ($det_book as $baris){
 array_push($details,array(
    'book_id'=>$baris,
    'quantity'=>$det_qty[$index],
    'uom_id'=>$det_uom[$index]
));
$index++; }
$error="";
if (!$this->db->insert_batch('trx_inbound_detail',$details))
{
    $error = $this->db->error();
}

```

Any miss or something wrong with my code? 
Already search in community but still no luck.
Appreciate if you also suggest other ways.
Thanks