Can anybody help me figure out...
I've got an array that has keys matching the class id, and value is how many students. I need to take (# students x cost-class213) + (# students x cost-class213) = total cost.
Below, I can't get qty_insert to work, so the math breaks down.
Code:
$ids = $_POST['workshop_id'];
foreach ($_POST['workshop_id'] as $id){
$qty = $_POST['participatqty'][$id];
}
// above 'participatqty' is an Array ( [215] => [213] => 1 [212] => 2 [214] => )
if(sizeof($_POST['workshop_id'])) {
// loop through array
$number = count($ids);
for ($i=0; $i<=$number; $i++)
{
// store a single item number and description in local variables
$itno = $ids[$i];
$qty_insert = $qty[$i];
// below is the math
$qty_total=$qty_insert*$z_row['workshop_price'];
$total = $total + $qty_total;