I am doing a mail function in PHP. As the body of the mail function, I have a table which displays all the posted values including checkboxes.
The message is as follows:
$bname = $_POST['$bname']; $message = Business Name : $bname
The above message is in table and Business Name is one td and $bname is another td. Now I have a chechbox array as
$c1 = $_POST['$c1'];
I have tried using
foreach ($c1 as $c2) { echo $c2; }
The above statement gives me a correct posted values.
But now I have to include this in table of the $message. If I include the full foreach in td, it displays the full foreach as it is. I tried catching the full foreach in one variable, and then put this variable directly in td, but did not get the values.
Please provide me a solution to this.
Thanks in advance
<input type="checkbox" name="cbox[]" value="male">
<input type="checkbox" name="cbox[]" value="female">
$checkboxes = implode(",",$_POST['cbox']);
now you can use $checkboxes anywhere in the message
Remove the dollar from $c1
if your post field is named c1
:
$c1 = $_POST['c1'];