I am working on an eCommerce website.I have a product page where i have single form to add multiple product quantities at the same time using the button . On my products page,within my single form i am sending individual product values to next page like these using the loop:
<?
$query_data=$this->db->get('products');
foreach($query_data->result() as $product)
{
?>
<input name="productname[]" value="<?=$product->Name?>" type="hidden" />
<input type = "hidden" id = "product_id" name = "product_id[]" value = "<?=$product->Code?>" />
<input name="num_pallets[]" id="num_pallets" value="<?=$pallet?>" type="hidden" />
<input type = "hidden" id = "num_packs" name = "num_packs[]" value = "<?=$packet?>" />
<input type="text" name="quantity[]" id="quantity" size="2" />
<input type = "hidden" id = "product_price" name = "product_price" value = "<?=$number?>" />
<?
}
?>
Where :
1) the "quantity" field is the quantity of the product a customer will order.
2) the "num_pallets" field is the pallet quantity of the product a product has in the database.
3) the "num_packs" field is the pack quantity of the product a product has in the database.
Now,i want to retrieve the corresponding values on shopping cart page so that i could perform calculations accordingly.
The other problem i have is that when i submit my form,it submits all the values INCLUDING THE products' values of those I dont enter quantity in the text boxes.
MY Question:
How can i loop through the products (I enter the "quantity" in text boxes) on my page so that it could give me the corresponding values of the ordered products ONLY i.e if i fill in the quantity text box of product(11760) then i want to process values of 11760 ,not other products.
How can i retrieve the corresponding values of 1 or more ordered product only ??Thanks