0
我有两个单独的数组,我的PHP邮件格式是不同的复选框组:网络细节和graphicdetails。只有一组将被填写(另一个将被隐藏,除非选择了前一个单选按钮。)我想知道如何在PHP中正确引用它们。组合两个单独的数组
这是我用来获取一个发布,但不是两个:
foreach($_POST['webdetails'] as $value1) {
$webdetails_msg .= "$value1\n";
}
我怎么在里面添加graphicdetails?复制的片段让我警告:()提供的foreach无效参数
我不知道远不止此PHP,这样的解释,将不胜感激。
-
这里的PHP我得到一个错误有:
<?php
/* Set mail headers */
$myemail = "[email protected]";
$subject = "New Request";
$webdetails = $_POST['webdetails'];
$graphicdetails = $_POST['graphicdetails'];
foreach($_POST['webdetails'] as $value1) {
$webdetails_msg .= "$value1\n";
}
foreach($_POST['graphicdetails'] as $value2) {
$graphicdetails_msg .= "$value2\n";
}
/* Let's prepare the message for the e-mail */
$message = "
Details:
$webdetails_msg
$graphicdetails_msg
";
/* Send the message using mail() function */
mail($myemail, $subject, $message);
<?php exit(); } ?>
HTML为webdetails:
<input type="checkbox" name="webdetails[ ]" id="design" value="Design" />
<input type="checkbox" name="webdetails[ ]" id="development" value="Development" />
<input type="checkbox" name="webdetails[ ]" id="web-updates" value="Web Updates" />
<input type="checkbox" name="webdetails[ ]" id="forum-template" value="Forum Template (Full)" />
<input type="checkbox" name="webdetails[ ]" id="forum-graphics" value="Forum Graphics" />
<input type="checkbox" name="webdetails[ ]" id="web-other" value="Other" />
HTML为graphicdetails:
<input type="checkbox" name="graphicdetails[ ]" id="graphic-logo" value="Logo Design" />
<input type="checkbox" name="graphicdetails[ ]" id="graphic-social" value="Social Media Graphics" />
<input type="checkbox" name="graphicdetails[ ]" id="graphic-other" value="Other" />
是否所有''在同一'
是的,都一样。 –