I am trying to insert the value of multiple checkboxes if they are checked into one column in my database.
Here is what I have...
if(!empty($_POST['dyuhdb'])) {
foreach($_POST['dyuhdb'] as $dyuhdb) {
$dyuhdb . ",";
}
}
$sql = "INSERT INTO MRF (Q1) VALUES ('". $dyuhdb ."')";
<div class="checkbox">
<label><input type="checkbox" name="dyuhdb[]" value="1">1</label>
</div>
<div class="checkbox">
<label><input type="checkbox" name="dyuhdb[]" value="2">2</label>
</div>
<div class="checkbox">
<label><input type="checkbox" name="dyuhdb[]" value="3">3</label>
</div>
For some reason, if 1 and 2 are ticked, only 2 will enter into my Database?
What am I doing wrong?