Sanitising a POST array for INSERT query
<p>Morning SO,</p>

<p>I have a checkbox array (name = "cat[]") in a form which at present, contains six values, 1- 6 (it may contain more in the future). A user can select any number of these. </p>

<p>These values are then collected in:</p>

<pre><code>$_SESSION['cat'] = $_POST['cat'];
</code></pre>

<p>(They're in a session because there's a step or two before the actual insert query)</p>

<p>What i want to do is Sanitise them. I have tried </p>

<pre><code>$_SESSION['cat'] = (int)$_POST['cat'];
</code></pre>

<p>But that seems to strip all values from it. </p>

<p>Can someone help with the appropriate method of sanitising this for safe insertion into a database?</p>

<p>Thanks in advance, as always,
Dan</p>
