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 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺