dongxifu5009 2014-12-27 13:42
浏览 46

获取输入Array Laravel不工作

I'm creating an array of input in my form. And i wanna get this array on my controller in Laravel.

My inputs is hidden type, and i add this fields dynamically through JavaScript, using Backbone.

I add this inputs on my form:

<input type="hidden" name="id_poi[]" class="id_poi" value="">

The value is also set dynamically in JavaScript.

After i add this input, this is my DOM: DOM

So, i can add many inputs on my form.

When i'll handle this array on Laravel, i just get the value of the last input of this array.

I'm testing in this way:

public function store() {
    var_dump(Input::all());
    return;
}

And i had this output:

Test post vars

What i'm doing wrong to fail to get the values in an array?

EDIT:

I had other element with the same name in my form, and i change it. But the problem isn't solved yet, when i submit the form, the elements added dynamically isn't sent to PHP. Resulting in the same output above.

  • 写回答

1条回答 默认 最新

  • dreamact3026 2014-12-27 13:49
    关注

    inputs is hidden name edit. Example

    name="id_poi[0]"
    name="id_poi[1]"
    

    Sory, my English not good.

    评论

报告相同问题?

悬赏问题

  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大