I have a form where people choose one or more classes, and how many people they're enrolling.

Once they've picked a class and the number of enrollees, they press submit and go to registration page 2 where the totals are summed based on class costs and # of students. Here's where I'm having trouble:

Page one is sending the number of students for each class in an array that matches the class number. For example, there were 4 classes available and they selected class 213 - 1 student, and class 214 - 2 students:

Array ( [215] => [213] => 1 [212] => 2 [214] => )

But I'm not understanding how to generate that number when I echo out and do the math:

here's what I've got on page two:

Code:
<?php
// several other variables were set here, dumped into db then...
// store all posted intemnos and descriptions in local arrays 

$ids = $_POST['workshop_id'];
print_r($_POST['participantqty']);

// the above shows the arrays  are sending and printing correctly: Array ( [215] => [213] => 1 [212] => 2 [214] => )
 
foreach ($_POST['workshop_id'] as $id){
   $qty = $_POST['participatqty'][$id];
}

// is the above not how I do this? Does it go somewhere else

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];
print_r($qty_insert);

			$query_insertItemWorkshop = "INSERT INTO tbl_registration_workshop (registration_id, workshop_id, regworkshop_qty) VALUES ('$reg_id', '$itno', '$qty_insert')"; 
			$dberror = "";
			$ret = mysql_query($query_insertItemWorkshop);
		$query_selectAllItems_events = 'SELECT * FROM tbl_workshops where workshop_id = '.$itno;
	@$result_all_events = mysql_query($query_selectAllItems_events);
	@$numRows_all_events = mysql_num_rows($result_all_events);
	@$num=mysql_num_rows($result_all_events); 
	@$z_row = mysql_fetch_array($result_all_events);
	$qty_total=$qty_insert*$z_row['workshop_price'];
	$total = $total + $qty_total;
    
    if ($ids[$i] <> '') { 
	// below at qty_insert is where the number isn't generating
echo "<tr><td valign=top><b>Description:</b> ". $z_row['workshop_title'] ."</td><td align='right' colspan='2' width=300 valign=top>" . $qty_insert . " at ". $z_row['workshop_price'] ." each: &nbsp;</td><td valign=top> $". $qty_total ."</td></tr>";

	    } 
} 	
}



			
?>