concatenate string in php foreach
<p>I should be able to figure this out, but I keep going in circles.  I have a form with checkboxes.  When the checkboxes are selected they tagged to be deleted.</p>

<p>I process those selected checkboxes with a foreach:</p>

<pre><code>foreach (array_keys($_POST['checkboxselect']) as $k) {
    $str .= $k.',';
}
</code></pre>

<p>This is my lame attempt to put the list of videos together. The sql delete I'm using is:</p>

<pre><code>DELETE FROM `videos` WHERE `video_name` IN ($str)
</code></pre>

<p>So I'm missing lots of things here.  The <code>$str</code> needs to have:</p>

<ol>
<li>Only one checkbox is returned so return string with quotes (i.e. "myvideo.mp4")</li>
<li>Multiple checkboxes are selected so build a string with quotes and commas (i.e. "myvideo.mp4","myvideo2.mp4","myvideo3.mp4")</li>
</ol>

<p>Thanks for the help.</p>
