I have a basic shopping cart script that works fine, storing items in a session. The only thing I can't get figured out is how to loop through the items in the session so that multiple items can be added into a Paypal form.
As I understand it, multiple items in the Paypal form need to be listed as "item_name_1", "item_name_2", etc. I can't figure out a for/while loop to increment the item/form names to do this. Any help is appreciated.
$output[] = '<table><tr>'; $output[] = '<td colspan="6" class="productinfo">Make any changes you like to your order, then click the "Update My Cart" button.<br/><br/><button type="submit">Update My Cart</button><br/><br/></td>'; $output[] = '</tr></table>'; $output[] = '</form>';
if($zipcode) { $output[] = '<table><tr>'; $output[] = '<td colspan="6" class="productinfo"><br/>'; $output[] = '<form action="cart.php?action=updatezip" method="post" id="cart">'; $output[] = 'Your ZIP Code: '.$zipcode.' <input type="text" name="zipcode" size="10"> <input type="submit" value="Update ZIP Code"><br/><br/></td>'; $output[] = '</tr></table>'; $output[] = '</form>'; $output[] = '<table><tr>'; $output[] = '<td colspan="6" class="productinfo">'; $output[] = 'If you are ready to checkout, click the button below to be transferred to <a href="http://www.paypal.com">PayPal®</a>.<br/><br/>';