Php 表单输入数组未处理

Php 表单输入数组未处理,php,arrays,forms,Php,Arrays,Forms,我有一个带有两个复选框问题的表单,我正在使用PHP将回复放入电子邮件中。第一个仅在电子邮件中返回“Array”,即使选中复选框也是如此。第二个返回复选框值,如果未选中,则返回数组 我已经尝试过移除第二个,以防它导致第一个破裂,但仍然无法工作。我是PHP新手,有人能帮我弄清楚为什么这不起作用吗 我在提交表单时没有看到任何错误或警告。以下是相关的PHP: $ownership = array(); if(isset($_POST['ownership'])) $ownership = nl2b

我有一个带有两个复选框问题的表单,我正在使用PHP将回复放入电子邮件中。第一个仅在电子邮件中返回“Array”,即使选中复选框也是如此。第二个返回复选框值,如果未选中,则返回数组

我已经尝试过移除第二个,以防它导致第一个破裂,但仍然无法工作。我是PHP新手,有人能帮我弄清楚为什么这不起作用吗

我在提交表单时没有看到任何错误或警告。以下是相关的PHP:

$ownership = array();
   if(isset($_POST['ownership'])) $ownership = nl2br(implode(', ', $_POST['product-types-owned']));
$firstprod = nl2br($_POST['First_prod']);
$cook  = array();
   if(isset($_POST['cook'])) $cook = nl2br(implode(', ', $_POST['cook']));
以下是表单中不起作用的部分(不在电子邮件中打印):

铸铁烤炉和;炖菜
煎锅及;烤架
专业
三层不锈钢
锻造硬质阳极氧化
这是表格中起作用的部分:

<input type="checkbox" name="cook[]" style="outline: none; border: none;" value="Slow_Cooking" /> Slow Cooking</label>
  <label style="line-height: 1.8;vertical-align: top; display: block; margin-left: 10px; width: auto;" for="Kid_Friendly_Meals">

<input type="checkbox" name="cook[]" style="outline: none; border: none;" value="Kid_Friendly_Meals" /> Kid Friendly Meals</label>
  <label style="line-height: 1.8;vertical-align: top; display: block; margin-left: 10px; width: auto;" for="Holiday_Entertaining">

<input type="checkbox" name="cook[]" style="outline: none; border: none;" value="Holiday_Entertaining" /> Holiday Entertaining</label>
  <label style="line-height: 1.8;vertical-align: top; display: block; margin-left: 10px; width: auto;" for="International">

<input type="checkbox" name="cook[]" style="outline: none; border: none;" value="International" /> International</label>
  <label style="line-height: 1.8;vertical-align: top; display: block; margin-left: 10px; width: auto;" for="Quick_and_Easy">

<input type="checkbox" name="cook[]" style="outline: none; border: none;" value="Quick_and_Easy" /> Quick and Easy</label>
慢煮
爱婴餐
假日娱乐
国际的
轻快

是的,我知道内联样式有多难看,我不得不这样做,原因与这个问题无关。

第一个在HTML中被称为
producttypes owned
,您正在PHPwow中寻找
$\u POST['ownership']
。我很尴尬。我责备8个小时盯着代码看(不仅仅是这个)。感谢您指出显而易见的问题!没什么好尴尬的;我认为网站上没有人没有犯过类似的错误。@andrewsi否决这些问题的人请求不同意见。
<input type="checkbox" name="cook[]" style="outline: none; border: none;" value="Slow_Cooking" /> Slow Cooking</label>
  <label style="line-height: 1.8;vertical-align: top; display: block; margin-left: 10px; width: auto;" for="Kid_Friendly_Meals">

<input type="checkbox" name="cook[]" style="outline: none; border: none;" value="Kid_Friendly_Meals" /> Kid Friendly Meals</label>
  <label style="line-height: 1.8;vertical-align: top; display: block; margin-left: 10px; width: auto;" for="Holiday_Entertaining">

<input type="checkbox" name="cook[]" style="outline: none; border: none;" value="Holiday_Entertaining" /> Holiday Entertaining</label>
  <label style="line-height: 1.8;vertical-align: top; display: block; margin-left: 10px; width: auto;" for="International">

<input type="checkbox" name="cook[]" style="outline: none; border: none;" value="International" /> International</label>
  <label style="line-height: 1.8;vertical-align: top; display: block; margin-left: 10px; width: auto;" for="Quick_and_Easy">

<input type="checkbox" name="cook[]" style="outline: none; border: none;" value="Quick_and_Easy" /> Quick and Easy</label>