Submit two forms with one button

后端 未结 7 1639
面向向阳花
面向向阳花 2020-11-22 04:20

I have HTML two forms, one that submits data upon entry to a database using PHP, the other directs the user to a paypal payment page, my problem is that the user would have

7条回答
  •  梦谈多话
    2020-11-22 04:49

    You should be able to do this with JavaScript:

    
    

    If your forms have IDs:

    submitForms = function(){
        document.getElementById("form1").submit();
        document.getElementById("form2").submit();
    }
    

    If your forms don't have IDs but have names:

    submitForms = function(){
        document.forms["form1"].submit();
        document.forms["form2"].submit();
    }
    

提交回复
热议问题