insert_batch data array to database table
I want insert following data by `insert_batch` as in following example:

HTML:

    <input name="u_id[0][0]" value="76">
    
    <input name="un[0][0]" value="1">
    <input type="text" name="ue[0][0]" value="11">
    <input type="text" name="up[0][0]" value="111">
    
    
    
    <input name="u_id[1][0]" value="77">
    
    <input name="un[1][1]" value="2">
    <input type="text" name="ue[1][1]" value="22">
    <input type="text" name="up[1][1]" value="222">
    
    <input name="un[1][2]" value="3">
    <input type="text" name="ue[1][2]" value="33">
    <input type="text" name="up[1][2]" value="333">

PHP:

    $u_id       = $this->input->post('u_id');
    $un       = $this->input->post('un');
    $up       = $this->input->post('up');
    $ue       = $this->input->post('ue');
    
    $data = array();
    foreach ($residence_un as $idx => $name) {
	    $data[] = array(
		    'u_id' => $u_id[$idx],					
		    'un' => $un[$idx],
		    'up' => $up[$idx],
		    'ue' => $ue[$idx],
	    );
    };
    $this -> db -> insert_batch('units', $data);


I want insert they as this:


![enter image description here][1]


  [1]: http://i.stack.imgur.com/AjwXP.png


How should change php code and html code? what do i do?
insert_batch data array to database table
===

I want insert following data by `insert_batch` as in following example:

HTML:

    <input name="u_id[0][0]" value="76">
    
    <input name="un[0][0]" value="1">
    <input type="text" name="ue[0][0]" value="11">
    <input type="text" name="up[0][0]" value="111">
    
    
    
    <input name="u_id[1][0]" value="77">
    
    <input name="un[1][1]" value="2">
    <input type="text" name="ue[1][1]" value="22">
    <input type="text" name="up[1][1]" value="222">
    
    <input name="un[1][2]" value="3">
    <input type="text" name="ue[1][2]" value="33">
    <input type="text" name="up[1][2]" value="333">

PHP:

    $u_id       = $this->input->post('u_id');
    $un       = $this->input->post('un');
    $up       = $this->input->post('up');
    $ue       = $this->input->post('ue');
    
    $data = array();
    foreach ($residence_un as $idx => $name) {
	    $data[] = array(
		    'u_id' => $u_id[$idx],					
		    'un' => $un[$idx],
		    'up' => $up[$idx],
		    'ue' => $ue[$idx],
	    );
    };
    $this -> db -> insert_batch('units', $data);


I want insert they as this:


![enter image description here][1]


  [1]: http://i.stack.imgur.com/AjwXP.png


How should change php code and html code? what do i do?