我如何 post 使用简单的 php 形成复选框数据?

How can I post form checkbox data using simple php?

您好,我是 PHP 的新手,我决定尝试为我正在创建的网站创建一个表单。除了发送复选框数据之外,我设法这样做是为了转到我的邮件地址 - 如果选中了多个复选框,则只有最后选中的复选框才会显示在 posted 电子邮件中。任何人都可以让我知道我该怎么做吗? 这是 www.newsite0914.i4dsign.co.uk/contact.php:

中的表单代码
<form id="contact_form2" name="contact_formB" method="post" action="post.php">
        .....
                    <table border="0" cellpadding="0" cellspacing="0" width="100%" id="nestedTable2">
                    <tr>
                    <td colspan="2">
                    Services interested in&quest;
                    </td>
                    </tr>
                    <tr>
                    <td valign="top">
                    Website <input type="checkbox" name="service[]" value="web" />
                    </td>
                    <td align="right">
                    Logo <input type="checkbox" name="service[]" value="logo" style=" margin-right: 50px;" />
                    </td>
                    </tr>
                    <tr>
                    <td>
                    Stationery <input type="checkbox" name="service[]" value="stationery" />
                    </td>
                    <td valign="top" align="right" >
                    Advert <input type="checkbox" name="service[]" value="advert"style=" margin-right: 50px;" />
                    </td>
                    </tr>
                    <tr>
                    <td valign="top" colspan="2">
                    Other <input type="checkbox" name="service[]" value="other" /> <textarea cols="25" rows="1" name="other" value="other"style="margin-left: 10px;"></textarea>
                    </td>
                    </tr>
                    </table>
                ...
            <tr>
                <td colspan="2">
                Security Task: 6 + 7 =
                <input name="security" size="2" />

                <input type="submit" value="Send your details" onClick="checkDetailsB()" style="margin-left: 20px;"  /> 

                <!--<input type="reset" value="Reset"  />-->
                </td>
            </tr>
        </table>
        </form>

这里是 post php 脚本 (www.newsite0914.i4dsign.co.uk/post.php):

$to = "julian@i4dsign.co.uk";
$subject = "New Contact Form Submission";
$message = "....\n\nService: $service[$i]\n\n....";

if ($security=="13"){
    mail($to,$subject,$message);    
    header("Location:contact.php?s=1");
}
else{
    header("Location:contact.php?s=2");
}

提前谢谢你。希望有人能帮忙。

$to = "julian@i4dsign.co.uk";
$subject = "New Contact Form Submission";
$message = "\n\nService: " . implode(', ', $_POST['service']);