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. Link to comment https://forums.phpfreaks.com/topic/131660-solved-array-help/ 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 } Link to comment https://forums.phpfreaks.com/topic/131660-solved-array-help/#findComment-683840 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.