My problem is similar to Submitting a multidimensional array via POST with php
The only difference is, that my data are generated from a csv file:
<?php
$fileHandle = fopen("data/group.csv", "r");
while (($row = fgetcsv($fileHandle, 0, ";")) !== FALSE) {
echo '<tr>';
echo '<td>';
echo '<label for="id">' . $row[0] . '</label>';
echo '</td>';
echo '<td>';
echo '<label for="description">' . $row[1] . '</label>';
echo '</td>';
echo '<td valign="top">';
echo '<label for="diameter">' . $row[2] . '</label>';
echo '<td>';
echo '<input type="radio" name="' . $row[0] . '" value="' . $row[3] . '" checked="checked">' . $row[3] . ' pcs';
echo '</td>';
echo '<td>';
echo '<input type="radio" name="' . $row[0] . '" value="' . $row[4] . '">' . $row[4] . ' pcs';
echo '</td>';
echo '<td>';
echo '<input type="radio" name="' . $row[0] . '" value="' . $row[5] . '">' . $row[5] . ' pcs';
echo '</td>';
echo '</tr>';
}
?>
To review this before sending, I am using the following code which works just fine:
<?php
echo '<pre>'; print_r($_POST); echo '</pre>';
foreach ($_POST as $id => $amount) {
if ($amount <> 0) {
echo '<tr>';
echo '<td>';
echo '<label for="id">' . $id . '</label>';
echo '</td>';
echo '<td>';
echo '<label for="amount">' . $amount . ' pcs</label>';
echo '</td>';
echo '</tr>';
}
}
?>
and the array looks like this:
Array
(
[5465653] => 0
[81613] => 0
[21318] => 400
[348787] => 400
[663] => 800
)
so the formated output is for example
id amount
21318 400 pcs.
348787 400 pcs.
663 800 pcs.
The problem is, however, I can't get the other rows (description and diameter) into review page, so the output looks like this:
id description diameter amount
21318 Description 10 400 pcs.
348787 Description 10 400 pcs.
663 Description 15 800 pcs.
Any help would be appreciated.