dream198731 2011-03-25 03:59
浏览 37
已采纳

CodeIgniter:将数组从表单传递给控制器​​,然后传递模型以插入数据库

I've got a form in a view. The following row can be duplicated over and over allowing the client to add as many trashcans as they wish: https://gist.github.com/886337

The problem starts when I try to get the array from $invoice_item

If I have just one line item:

I've tried $invoice_items = $this->input->post('$invoice_item');

but if I do var_dump($invoice_items); to see what I have I get bool(false)

So, I tried: $invoice_items = array($this->input->post('$invoice_item'));

and again var_dump gives me this: array(1) { [0]=> bool(false) }

And then I've tried other things like adding [] after $invoice_items or $invoice_item but nothing seems to work. I just don't know what I'm doing?

Any help would be appreciated because I am lost!

  • 写回答

1条回答 默认 最新

  • douchen9569 2011-03-25 04:18
    关注

    you should get your post variable like

    $invoice_items = $this->input->post('invoice_item');
    

    (there is no $ sign)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源