Parsing unknown POST Args in PHP I have an HTML form being populated by a table of customer requests.  The user reviews each request, sets an operation, and submits.  The operation gets set into a post arg as follow

$postArray = array_keys($_POST);


[1]=>Keep [2]=>Reject [3]=>Reject [4]=>Ignore ["item id"]=>"operation"

This is how I am parsing my Post args... it seems awkward, the unused $idx.  I am new to PHP, is there a smoother way to do this?

$postArray = array_keys($_POST);            
foreach($postArray as $idx =&gt; $itemId) {            
    $operation = $_POST[$itemId];
    echo "$itemId $operation &lt;/br&gt;";
    ...perform operation...
}
It looks like you may want to unset the 'item id' entry in your post array before you do the processing:

unset($_POST['item id']);

Then you can use foreach to loop over the key (idx) and value (operation).

foreach ($_POST as $idx =&gt; $operation)
{
    echo $idx . ' ' . $operation . '&lt;/br&gt;';
    // perform operation.
}


The array_keys function was unnecessary because foreach can be used with associative arrays handling both their keys and values.