djones Posted November 6, 2008 Share Posted November 6, 2008 I have cart items that I need to loop through to update certain values for each one. In each cart row there will be 4 input fields like this: // Get posted items from loop below ... // Begin loop echo '<input type="text" name="cart_id[]" value="' . $cart_id . '" /> <input type="text" name="qty[]" value="' . $qty . '" /> <input type="text" name="configured[]" value="' . $configured . '" /> <input type="text" name="config[]" value="' . $config . '" />'; // End loop How can I loop through each set of the above to get the values after I've posted them? Of course the CART_ID will be the key in the array because it will be the only unique value. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted November 6, 2008 Share Posted November 6, 2008 foreach($_POST['cart_id'] as $n=>$cart_id){ $qty = $_POST['qty'][$n]; $configured = $_POST['configured'][$n]; $config = $_POST['config'][$n]; //Now you can work with $cart_id, $qty, $configured, and $config } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.