Use foreach to grab all but the last key, value pairs
<p>I have a form with a lot of radio buttons and then a hidden field at the end. </p>

<p>I am looping through all of the input values to put them into an INSERT like this :</p>

<pre><code>$count=count($_POST);
$counter=0;
$queryV="INSERT INTO `notes_value` ( `style_color`, `value` ) VALUES ";
$sku = $_POST['number'];  //this is the one value coming from a hidden input

    foreach ($_POST AS $key =&gt; $value) {
        if ($counter &lt; $count -1 )
        $queryV.= "('$sku', '$value'),";
        elseif ($counter = $count -1 )
        $queryV.= "('$sku', '$value');";
        $counter++; 
    }
</code></pre>

<p>I am going to use the <code>$key</code> for a separate <code>INSERT</code> to a different table but my problem here is that final hidden input I dont want in the <code>$queryV</code> I need all of the values except the last <code>$_POST</code></p>

<p>What I have here gives me something like :</p>

<pre><code>INSERT INTO `notes_value` ( `sku`, `data` ) VALUES ('12595200010037', 'yes'),('12595200010037', '12595200010037');
</code></pre>

<p>This is in an example where only one radio button was selected.  In such a situation I would want it to only return that one <code>$sku, $value</code> pair.  I never want the last <code>$key, $value</code> that comes from this <code>foreach</code>.  So I would want to see this : </p>

<pre><code>INSERT INTO `notes_value` ( `sku`, `data` ) VALUES ('12595200010037', 'yes');
</code></pre>
