Add 3 forms to 1 submit

1
I have 3 forms: form1 , form2 and form3 . p>

I do not know how I can "merge" them so that I only need a <input type=submit /> for the three instead of creating a Submit for each

  • Is there any way to do this?

  • Yes , where can I find documentations ?

asked by anonymous 04.10.2016 / 22:06

1 answer

4

Assuming you want to send all the data in the same submit and that uses jQuery , I'll propose the following solution:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script><formid="form-1">
    //seus campos aqui
</form>
<form id="form-2">
    //seus campos aqui
</form>
<form id="form-3">
    //seus campos aqui
</form>
<input type="submit" id="submit-forms"/>
<script>
$(function(){
    $('#submit-forms').click(function(){
        window.location.href = "urldesubmit.com.br?" + $('#form-1').serialize() + '&' + $('#form-2').serialize() + '&' + $('#form-3').serialize();
    });
});
<script>

It's a bit of a gambiarra, but it should work.

    
04.10.2016 / 22:48