我已经实现了一个表单,可以成功地将提交的信息发送到我的电子邮件中。我可以通过除复选框之外的所有输入来实现这一点。我必须做什么才能使复选框值也出现在我的电子邮件中?我尝试为每个循环使用一个,但我不知道我是否沿着正确的路线。相关代码如下:
代码:
$companyname = $_POST['companyname'];
$fullname = $_POST['fullname'];
$email = $_POST['email'];
$phonenumber = $_POST['phonenumber'];
foreach($_POST['check'] as $value) {
$check_msg .= "Checked: $value\n";
}
$to = 'woodsy0130@hotmail.com';
$subject = 'Quote';
$message = 'Company Name: '.$companyname. "\n"."\n". 'Full Name: ' .$fullname. "\n"."\n". 'E-mail: '.$email. "\n"."\n". 'Phone Number: '.$phonenumber. "\n"."\n". 'Features: '$check_msg;
HTML:
<label><input type="checkbox" name="check[]" id="q12_1" value="E commerce Shopping Cart" />E-commerce (Shopping Cart)</label>
<label><input type="checkbox" name="check[]" id="q12_2" value="Content Management System CMS" />Content Management System (CMS)</label>