foreach ($_POST as $collection) { if (array_key_exists ('submit', $collection)) { // this is the one we need $secret = $collection['secret']; $id = $collection['product-id']; break; } }