Editing specific fields from a POSTed form in a plugin I'm struggling to figure out how to do what I need to do, and I think it's more a lack of PHP skill than Craft/Commerce per-se.

I have a plugin that receives POSTed data such as this:

&lt;input name="items[1][qty]" value="6" type="hidden"&gt;
&lt;input name="items[1][note]" value="" type="hidden"&gt;
&lt;input name="items[1][purchasableId]" value="164" type="hidden"&gt;
&lt;input name="items[1][options][endDate]" value="2026-11-03" type="hidden"&gt;
&lt;input name="items[1][options][friday]" value="2" type="hidden"&gt;
&lt;input name="items[1][options][monday]" value="2" type="hidden"&gt;
&lt;input name="items[1][options][startDate]" value="2016-11-05" type="hidden"&gt;
&lt;input name="items[1][options][wednesday]" value="2" type="hidden"&gt;
&lt;input name="items[1][options][uniqueCode]" value="1553135711" type="hidden"&gt;

&lt;input name="items[2][qty]" value="6" type="hidden"&gt;
&lt;input name="items[2][note]" value="" type="hidden"&gt;
&lt;input name="items[2][purchasableId]" value="193" type="hidden"&gt;
&lt;input name="items[2][options][endDate]" value="2026-11-03" type="hidden"&gt;
&lt;input name="items[2][options][friday]" value="2" type="hidden"&gt;
&lt;input name="items[2][options][monday]" value="2" type="hidden"&gt;
&lt;input name="items[2][options][startDate]" value="2016-11-05" type="hidden"&gt;
&lt;input name="items[2][options][wednesday]" value="2" type="hidden"&gt;
&lt;input name="items[2][options][uniqueCode]" value="736114426" type="hidden"&gt;


I need to amend any and all inputs that represent a startDate (e.g., &lt;input name="items[1][options][startDate]" value="2016-11-05" type="hidden"&gt; ). Then hand over to the controller that's going to process the data.

In detail: this is a Commerce related thing using MultiAdd. I need to adjust those startDate values prior to handing off to MultiAdd to do it's thing. The pertinent bit of my plugin looks like this:

public function actionReorder() {
    ... a bunch of stuff relating to the cart ...

    // loop through all the inputs for line items and amend any startDate
        $items = craft()-&gt;request-&gt;getPost('items');

        ... magic happens here ? ...

    // ok now pass it all over to the multiAdd controller...
        craft()-&gt;runController('multiAdd/multiAdd');
}
You will want to use PHP's foreach to loop over each of the items (using $i here to keep track of the index). Then if the current item has a start date, do whatever it is you need to edit it inside the loop. Once you've finished iterating over each item, you will need to set that back to $_POST['items'], so that the MultiAdd plugin can pick up your modified array as usual, using craft()-&gt;request-&gt;getPost('items').

public function actionReorder() {
    // ... a bunch of stuff relating to the cart ...

    // loop through all the inputs for line items and amend any startDate
    $items = craft()-&gt;request-&gt;getPost('items');

    foreach ($items as $i =&gt; $item)
    {
        if (isset($item['options']['startDate']))
        {
            $items[$i]['options']['startDate'] = '???';
        }
    }

    // re-set back to $_POST
    $_POST['items'] = $items;

    // ok now pass it all over to the multiAdd controller...
    craft()-&gt;runController('multiAdd/multiAdd');
}