duanpaxin3531 2010-09-28 06:50
浏览 72
已采纳

如何在邮件功能的邮件正文中打印复选框数组


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

  • 写回答

2条回答 默认 最新

  • dousheyan0375 2010-09-28 06:59
    关注
    <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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?