首页 > 解决方案 > 在表单上传递选择多个

问题描述

我正在使用 codeiniter ,用 Twig 作为模板引擎,我在模板上有这个选择多个

<form action="{{ base_url }}mydirection/encuestas/perfil_interna" method="post" >
     <select multiple="multiple" name="profile_questions">
           {% for question in questions %}
                  <option id="qid_{{question.id}}">{{ question.text}}</option>
           {% endfor %}
      </select>
      <input type="submit" value="Enviar">
  </form>

这是控制器上的功能

public function set_profile_internal_question(){
        var_dump($_REQUEST);
}

但是我得到了空数组

并且该路线仅在没有该方法的情况下有效

$route['mydirection/encuestas/perfil_interna']= 'Backend/Questions/set_profile_internal_question';

这种方式行不通

$route['mydirection/encuestas/perfil_interna']['POST']= 'Backend/Questions/set_profile_internal_question';

但它是一种形式,帖子应该可以工作。

标签: phpcodeignitertwig

解决方案


推荐阅读