Ich have the following code:
<input type="text" name="quantity[]">
<input type="text" name="totalPrice[]">
<input type="text" name="quantity[]">
<input type="text" name="totalPrice[]">
<input type="text" name="quantity[]">
<input type="text" name="totalPrice[]">
And this php-code:
for ($i=0;$i<count($_POST['quantity']);$i++) {
// replace prices
$replacedUnitPrice = strtr($_POST['unitPrice'][$i], $searchAndReplace);
$replacedTotalPrice = strtr($_POST['totalPrice'][$i], $searchAndReplace);
// hide unitPrice if '0'
if ($_POST['unitPrice'][$i] > 0) {
$showUnitPrice = $replacedUnitPrice . " €";
} else {
$showUnitPrice = "";
}
$html .= '<tr>
<td align="center">' . $_POST['quantity'][$i] . ' ' . $period . '</td>
<td>' . $_POST['position'][$i] . '</td>
<td class="cost">' . $showUnitPrice . '</td>
<td class="cost">' . $replacedTotalPrice . ' €</td>
</tr>';
$sumPrices += $_POST['totalPrice'][$i];
}
I want that the for loop starts with the highest number i have tried:
rsort($_POST['totalPrice']);
but this only sorts totalPrice
and i the others fields are ignored, i want that this fields also sorts correctly.
What im making false?
Thanks.