dozr13344 2014-07-13 14:29
浏览 201
已采纳

如何将多个HTML表单中的值添加到要发送的一个数组中

I'm building a mobile web application with which employees can submit their worked hours for a given week. The form shows 7 forms (each form represents a day), and is built by a php loop function which runs an array containing information from the week. Each day is a different form.

I cannot combine all days into one, because I need to allow employees to add fields to each day (form in div) themselves to add activities they performed while working.

It looks like this: enter image description here

If i combine all the days into one form, each time you add a field on a certain day, it adds the field to the first day (while you may need it on the last day).

The Question

I need to submit the entire week using one button. I have already seen javascript methods like

document.getElementById("form1").submit();
document.getElementById("form2").submit();

But this does not work properly. Can anyone provide me with a direction or some code which helps me to solve this? Any help would be highly appreciated!

  • 写回答

2条回答 默认 最新

  • douxing2156 2014-07-13 14:35
    关注

    Can you not just achieve this with one form?

    HTML

    <form>
        <fieldset>
            <!-- all your fields for the day -->
            <legend>Monday</legend>
        </fieldset>
    
        <fieldset>
            <!-- all your fields for the day -->
            <legend>Tuesday</legend>
        </fieldset>
        <!-- ... -->
    
        <input type="submit" />        
    </form>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料