The foreach statement in the cart.php prints out the productid value and the quantity. What I want to do now is the to post these values from cart.php page to process.php, as I want to be able to include the details when writing an insert statement for the order table. This would also contain the customer id from the customer table along with the productid and quantity.

Do I post the variables $key and $value in this instance to pass them to the process.php page as requested in the form action request. I presume they'd be passed using hidden input fields but I'm unsure on this.

Any help would be great.

list.php

Code:
echo '<form action ="cart.php" method="post">';
echo'<p><table border = "1" cellspacing="1">';
echo'<tr><td>Title</td><td>CD</td><td>Quantity</td></tr>';
while($row = mysql_fetch_array($result)){
	//print out all the details from the database table row in cells in a html table row
	echo '<tr>';
	echo '<td>'. $row['title'] .'</td>';
	echo '<td>'. $row['cd'] .'</td>';
	echo '<td><input name ="'.$row['productid'].'" type="text" /></td>';
	echo '</tr>';

}
echo'</table></p>';
echo'<input name="submit" type="submit" />';
echo'</form>';
cart.php

Code:
<?php
foreach($_POST as $key => $value){
	if ($value > 0){
	echo $key.'';
	echo 'The quantity is:'.$value;
	echo '<br/>';
	}
}
?>

<form action="process.php" method="post">
<table>
<tr>
    <td>First name:</td>
    <td><input name="firstname" type="text" value="<?php if(isset($_POST) && isset($_POST['firstname'])){
		echo $row['firstname'];
	}
	?>"/></td>
    <td></td>
  </tr>
  <tr>
    <td>Last name:</td>
    <td><input name="lastname" type="text" value="<?php if(isset($_POST)&& isset($_POST['lastname'])){
		echo $_POST['lastname'];
	}
	?>" /></td>
    <td></td>
  </tr>
<tr>
    <td></td>
    <td><input name="submit" type="submit" value="submit" /></td>
    <td>&nbsp;</td>
  </tr>
</table>
</form>