Skip to content Skip to sidebar Skip to footer

Error When Submitting Checkbox To Mysql

I have the following php code for submitting the form to the database the only problem is with the checkboxes ... on submitting the form this shows up Warning: join() [function.joi

Solution 1:

Your checkboxes should be in the form of an array...

<inputtype="checkbox"name="ckb[]"value="strenthofmaterials";><labelfor="StrengthofMaterials"> Strength Of Materials </label><inputtype="checkbox"name="ckb[]"value="dynamics";><labelfor="StrengthofMaterials"> dynamics </label>

Note : It is ckb[] instead of just ckb

Solution 2:

$ckb = array();
foreach($_POST['checkbox'] as$val){
    $ckb[] = (int) $val;
}
$ckb = implode(',', $ckb);

Try this one. $ckb should be an array. For security purpose $val is converted in integer.

Post a Comment for "Error When Submitting Checkbox To Mysql"