Here's the scenario, I have a form that contains checkboxes and when submitted will be sent to a certain email. I am trying to put the checked items into one string. Like option1 option2 option 3
Here is what I have done for now:
echo $message = foreach($_POST['checkbox'] as $checkbox){ echo $checkbox . "
";}
Desired output of $message:
Option1
Option2
Option3
Please make it as:
$message = '';
if (! empty($_POST['checkbox'])) {
foreach($_POST['checkbox'] as $checkbox) {
$message .= $checkbox . "
";
}
}