[eluser]Philipp Gérard[/eluser]
Your PHP code makes no sense.
$this->input->post("fieldname") equals $_POST["fieldname"] (accessing it via $this->input->post however is more safe generally speaking). Basically, you only set $_POST["x"][some_row] = $_POST["x"] ($data = one row of your array). Imagine an array like a 2 column table, using foreach means that you go through the table row by row accessing the value of the 2nd column using $data. If you also want to access the value of the first column, use foreach($array as $column_1 => $column_2){ ... }. I hope this clears up your confusion.
If you still have trouble, please post me the "virgin" version of your array, the way it hits your controller before you did any confusing stuff to it and tell me how you want your results ordered. I'll then show you the implementation.