Post edited 12:13 am – February 11, 2013 by WendyPorter
Hello,
I have the following issue, I use a dynamic table (no rows initially) with 4 columns (first three are select, last one is a text field). When I add rows and submit everything seems fine. Here is an example of $_POST for 3 rows:
["item_meta"]=> array(1) { [147]=> array(3) { [0]=> array(4) { [0]=> string(4) “Head” [1]=> string(11) “Code” [2]=> string(3) “A12″ [3]=> string(10) “02/01/2013″ } [1]=> array(4) { [0]=> string(0) “” [1]=> string(0) “” [2]=> string(0) “” [3]=> string(10) “02/02/2013″ } [2]=> array(4) { [0]=> string(4) “Neck” [1]=> string(3) “etc” [2]=> string(5) “A1234″ [3]=> string(10) “02/03/2013″ } } }
This is as expected. Three entries in item_meta[147] with 4 fields each (i.e. array(4)). Now let's take a look at the same $_POST, if I delete the second row:
["item_meta"]=> array(1) { [147]=> array(3) { [0]=> array(4) { [0]=> string(4) “Head” [1]=> string(11) “Code” [2]=> string(3) “A12″ [3]=> string(10) “02/01/2013″ } [2]=> array(3) { [0]=> string(4) “Neck” [1]=> string(3) “etc” [2]=> string(5) “A1234″ } [1]=> array(1) { [0]=> string(10) “02/03/2013″ } } }
That ain't right… I still have three entries in item_meta[147] and they are incomplete. First row [0] is fine. Second row [2] is not reindexed properly and is missing the last column value. And the last column value from the deleted row [1] appears as the last item [1] which should not be there…
What causes this issue? How can it be fixed?
Thank you and regards.