How to insert multiple checkbox entry into mysql using php?

RickyG

New member
I was trying to insert data from a form but it is not inserting the entry to the database.

Here’s the code

$Tours = $_POST['Tours'];
if (is_array($Tours)) {
foreach ($Tours as $key=>$val);
$content = $content . count($Tours);
for ($i=0;$i<count($Tours);$i++) {
$content = $content . "$Tours[$i]\n";
}

}

I made Tours a set with 4 selections but the entry is just blank. When i changed the type of Tours into a varchar, the word array is in the database not the selections made from the form.

I use the code above to display the selection and there's a number which appears before the selections like below. How do i get rid of the number?

4FirstChoice SecondChoice ThirdChoice FourthChoice
 
Back
Top