php - 在表单上传递选择多个
问题描述
我正在使用 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';
但它是一种形式,帖子应该可以工作。
解决方案
推荐阅读
- javascript - 如何将文本框和数据表值从视图发送到控制器?
- outlook - 如何使用 Microsoft 图形 API 跨邮箱获取电子邮件的唯一消息 ID?
- algorithm - 函数按预期执行,但在循环结束时返回 nil 值
- sql - 如何使用“选择 * table where * = ?” 在 Swift 中使用 Sqlite3
- python - 如何在变量的最重要数据上创建 python 箱线图
- java - 如何找到哈希图中的最小值?
- python - 在树莓派上测试简单音频的语法错误
- reactjs - 带有 wrapPageElement 的空查询结果
- java - JEE 使用 JNDI 与 JDBC 和 auth 应用程序级别
- python - 我正在尝试在 python 中制作一个从链接下载文件并将其移动到特定文件夹的程序