How to handle multiple checkboxes in a PHP form?
<p>I have multiple checkboxes on my form:</p>

<pre><code>&lt;input type="checkbox" name="animal" value="Cat" /&gt;
&lt;input type="checkbox" name="animal" value="Dog" /&gt;
&lt;input type="checkbox" name="animal" value="Bear" /&gt;
</code></pre>

<p>If I check all three and hit submit, with the following code in the PHP script:</p>

<pre><code>if(isset($_POST['submit']) {
   echo $_POST['animal'];
}
</code></pre>

<p>I get "Bear", i.e. the last chosen checkbox value even though I picked all three. How to get all 3?</p>
