Counter

Hi im am using a Custom Cart we have created in PHP and Paypal as a provider.

I am looking to create a loop of form fields to send to paypal which is essentially the product list… I have created a ForEach loop that creates the Inputs required no problem but i need to increment the Input Name by 1 each time so paypal knows they are different products…

For Example…



<input name="item_1" value="product name">
<input name="item_2" value="product name">
etc..

I have managed to get this far …


<?     foreach($cartitems as $item)
foreach ( $counter = 1; $counter <= 100; $counter += 1) 
 {?>
<input type="hidden" name="item_name_<? echo $counter; ?>" value="<? echo $item[2]; ?>">
<? } ?>

Which does the loop, product names are correct but is not incrementing the counter as expected (i get 100 copies of the first product and 100 copies of the second product!)

Help!?