dspym82000 2016-05-16 10:07 采纳率: 100%
浏览 62

如何保存多个表格?

I have a form and a button ... when the button is pressed in the form of adding the following fields:

<input type="text"  name="address" />
<input type="text"  name="city"    />

and if once again pressed the button in the form is again added field

I do not need to add in the estate []

<input type="text"  name="address[]" />
<input type="text"  name="city[]"    />

to get an array, because each field additions are stored in another table

how to sava all data in database

and it's all on laravel framework

  • 写回答

1条回答 默认 最新

  • dsjuimtq920056 2016-05-16 10:16
    关注

    if you want to use the same Name element, then you'll need the brackets []

    You can add an index $i like :

    <input type="text"  name="address[$i]" />
    <input type="text"  name="city[$i]" />
    

    And then when you receive your data, you can use the same loop to get store your data in an array. Let me know if you need more details.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度