I have a simple form, e.g:
HTML:
Your favorite food?
Pizza: <input type="checkbox" name="food[]" value="0" />
Beef: <input type="checkbox" name="food[]" value="1" />
Eggs: <input type="checkbox" name="food[]" value="2" />
Your Email?
<input type="text" name="email" />
I could get the result via foreach():
foreach($_POST['food'] as $food) {
echo $food;
}
Where I should put the Insertion query when the user choose more than one food:
$query = $DB->insert("INSERT INTO table VALUES('NULL','$food','$email')");
BS:
I should insert one row even if the user choose 3 foods. The food field accept more than one value
example:
user 1:
email: david@gmail.com food: 1
user 2:
email: jack@gmail.com food: 0 1 2