好的,我已经用谷歌搜索并搜索了更多信息,但我被卡住了。我对 php 的想法真的很陌生,但我终于让我的表单做我想做的事,除了当我将它发送到我的电子邮件时,它只显示我选中的框之一。我真的很讨厌寻求帮助,但就这样吧。
这是我的html:
<tr>
<td valign="left"><p>Please check all items needed *</p>
<p class="style2">(Default order will be one of each checked item unless otherwise indicated in the comments section.)</p>
<td valign="top">
<div align="left">
<input type="checkbox" name="supplies[]" value="black_toner" /> Black Toner<br />
<input type="checkbox" name="supplies[]" value="cyan_toner" /> Cyan Toner<br />
<input type="checkbox" name="supplies[]" value="magenta_toner" /> Magenta Toner<br />
<input type="checkbox" name="supplies[]" value="yellow_toner" /> Yellow Toner<br />
<input type="checkbox" name="supplies[]" value="black_drum" /> Black Drum<br />
<input type="checkbox" name="supplies[]" value="cyan_drum" /> Cyan Drum<br />
<input type="checkbox" name="supplies[]" value="magenta_drum" /> Magenta Drum<br />
<input type="checkbox" name="supplies[]" value="yellow_drum" /> Yellow Drum<br />
<input type="checkbox" name="supplies[]" value="waste_toner" /> Waste Toner<br />
<input type="checkbox" name="supplies[]" value="staples" /> Staples<br />
</div>
<td valign="top"> </td>
</tr>
这是我的 php
}
$email_message = "Form details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "First Name: ".clean_string($first_name)."\n";
$email_message .= "Last Name: ".clean_string($last_name)."\n";
$email_message .= "Company: ".clean_string($company)."\n";
$email_message .= "Location: ".clean_string($location)."\n";
$email_message .= "Machine Model: ".clean_string($machine_model)."\n";
$email_message .= "Supplies: ".clean_string($supplies)."\n";
$email_message .= "Email: ".clean_string($email)."\n";
$email_message .= "Telephone: ".clean_string($telephone)."\n";
$email_message .= "Comments: ".clean_string($comments)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
就像我说的,我已经尝试了我认为的一切,但显然有些地方是错误的。我需要添加什么到我的 php/html 或更改以从我的复选框中获取所有响应,而不仅仅是一个?如果有人有任何建议,我将不胜感激。(请尽可能具体,就像我说的,我是新手)谢谢!