Form Posting while Looping through arrays
Posted on 2006-04-12
I am trying to make a modification to my X-Cart shopping cart. I am trying to setup a page that displays all of my products and a shopper can say that they want 2 of this product, 3 of these, 5 of these... When they are all done, they click add to cart and it adds all of their selections. Now I have the page setup, but I need to get each element from these arrays to post seperately. For each item purchased, their are 4 input's that go along with it. SO, I need it to post those four items then go to the next set and post those four...and so on and so forth. Here is the code for my input types:
<INPUT type="hidden" name="productid" value="<?php echo $x_productid;?>">
<INPUT type="hidden" name="mode" value="add">
<input type="hidden" name="product_options" value="<?php echo $x_optionid ;?>">
<input type="text" name="amount" size="5" maxlength="3" value="">
To sum it up...I need productid,mode,prouduct_options, amount to all post to a cart.php, then loop through with arrays..
Your help is much appreciated.