php – 以Jquery select2形式发布POST

所以我使用的是Select2插件,在表单中发布多个选项时遇到问题.我可以选择多个选项,但只能传递一个
<form>
  <select multiple name="message-from-select" id="message-from-select" class="select2">
      <option value="janedoen@example.com">janedoen@example.com</option>
      <option value="antonius@example.com" selected="selected">antonius@example.com</option>
      <option value="michael@example.com" selected="selected">michael@example.com</option>
      <option value="bayjack@example.com">bayjack@example.com</option>
      <option value="stacy@example.com">stacy@example.com</option>
  </select>
</form>

在我的PHP页面上,当我选择多个选项后var_dump:

var_dump($_POST['message-from-select']);

我只得到一根绳子,即:

string 'michael@example.com' (length=19)

我需要转到隐藏的输入格式吗?

答案是在name属性之后加入[],这与插件几乎没有关系.
<select multiple name="message-from-select[]" id="message-from-select" class="select2">

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...