How to add checkbox array to zip file for download from a form
<p>I am trying to get a foreach loop to give me the checkbox values (which have the file names for values) from my form, to be added to a zip file. </p>

<pre><code>&lt;input type="checkbox" name="download[0]" value="Fact_Sheet_1.pdf" /&gt;
&lt;input type="checkbox" name="download[1]" value="Fact_Sheet_2.pdf" /&gt;
&lt;input type="checkbox" name="download[2]" value="Fact_Sheet_3.pdf" /&gt;
&lt;input type="checkbox" name="download[3]" value="Fact_Sheet_4.pdf" /&gt;
&lt;input type="checkbox" name="download[4]" value="Fact_Sheet_5.pdf" /&gt;
</code></pre>

<p>Works fine if I click on one checkbox but when I tick more than one checkbox only one file gets added to the zip file.</p>

<p>My code is below. Any suggestions would be appreciated.</p>

<pre><code>if(isset($_POST['submit']) )
    {
    foreach ($_POST['download'] as $key =&gt; $val) {
        $filename = 'Fact_Sheets/' . $val;
        }
    }
system("zip -r files/zipfile  $filename"); 
</code></pre>
