【发布时间】:2014-02-07 21:45:43
【问题描述】:
我的 PHP 表单没有发布表单中的多个选择选项。 这是我的 PHP:
if ($_POST['interested_in_testing'] != "")
{
$_POST['interested_in_testing'] = filter_var($_POST['interested_in_testing'], FILTER_SANITIZE_STRING);
$interested_in_testing = $_POST['interested_in_testing'];
}
else
died();
添加到电子邮件:
<br/>Interested In Testing: " . $interested_in_testing ;
这是我的选择:
<label class="custom">Interested In Testing</label>
<select name="interested_in_testing[ ]" multiple="multiple">
<option value="atas">ATAs</option>
<option value="ip_phones">IP Phones</option>
<option value="gateways">Gateways</option>
<option value="ip_pbx">IP PBX</option>
</select>
它不会为此字段发送任何内容。我所有的单个字段都可以正常发送。有什么帮助吗?谢谢
【问题讨论】:
-
它是一个数组,所以像对待一个数组一样对待它
name="interested_in_testing[]"所以!empty($_POST['interested_in_testing'][0]).. .. -
添加一个 print_r($_POST);在您的代码中(在 if 之前)并告诉我们显示的内容
-
还有
-
我原来是没有空格的。我正在尝试:/ @Raphael Malie 因为它是一封电子邮件,所以它无法识别非 html
-
这是一个选择。如果你想要多个值,为什么不使用复选框?