Multiple checkbox values into database looping
<p>trying to insert multiple values in my mySQL database this is what I've got so far.</p>

<pre><code>if (in_array(",", $_POST['categories'])) { /* Other was selected */}
        $cat = implode(" ,", $_POST['categories']);
        if (in_array(",", $_POST['subcat'])) { /* Other was selected */}
        $sub = implode(" ,", $_POST['subcat']);
        if (in_array(",", $_POST['type'])) { /* Other was selected */}
        $type = implode(" ,", $_POST['type']);
        if (in_array(",", $_POST['payment'])) { /* Other was selected */}
        $payment = implode(" ,", $_POST['payment']);

        $sql = "INSERT INTO tbl_locations SET

                name='".$_POST['name']."', 
                alias='".$_POST['alias']."',
                category_id='$cat',
                subcategory_id='$sub',
                tourism_type_id='$type',
                lgu_id='$payment',
                latitude='".$_POST['latbox']."', 
                longitude='".$_POST['lngbox']."'
            ";
        $qry= mysql_query($sql) or die (mysql_error());
        if ($qry)
        {   
            header("location:addsuccess.php");
            exit();
        }
</code></pre>

<p>As you can see there are not just 1 multiple entries but 4. . . would appreciate on how to proceed on this. ..  also my form all has <code>name=name[]</code> so no problems on the form. It just inserts single values into my db rather than multiple.</p>
