PHP: How to correctly loop through multi-dimen post arrays
<p>If I have a form with fields like this.</p>

<p><strong>THERE WILL BE MULTIPLE ROWS OF THESE FIELDS HENCE THE SQUARE BRACKETS</strong></p>

<pre><code>&lt;input type="text" name="txt-receipt-number[]" value="" /&gt;
&lt;input type="text" name="txt-stock-number[]"  value="" /&gt;
&lt;input type="text" name="txt-repair-code[]" value="" /&gt;
</code></pre>

<p>How do I loop through the $_POST variable to get the values because its getting the field names but not the values, what am I doing wrong please?</p>

<pre><code>$fields = array();
$values = array();

foreach($_POST as $field =&gt; $value) {
   $fields[] = $field;
   echo $value;

}
</code></pre>

<p>Output:</p>

<p>ArrayArrayArrayArrayArrayArrayArrayArrayArray</p>

<p>Update:</p>

<p>Sorry, quick edit for correct output...</p>

<p>Further Update:</p>

<p>Lets ignore the insert, how do I get the values please?</p>
