在另一个表格中提交表格

I have a form with POST method and an action of another page.

Within the form i have another form that I need to make submit with a different action but its submitting with the main form action.

this is my second form:

<script>
    function formSubmit()
    {
        document.getElementById("invoices_form").submit();
    }
</script>

<form action="resend_multiple_invoices.php" name="invoices_form" method="post">
    <input type="button" onclick="formSubmit()" value="Send Invoices" />
</form>

how can i get it to submit the second form and not the main one?

You cannot (universally) submit a nested form separately from its parent form. Nested forms are invalid HTML as outlined in the W3C prohibitions.

To solve your problem, I suggest you use two separate forms as follows:

<script>
    function invoicesFormSubmit()
    {
       document.getElementById("invoices_form").submit();
    }

    function otherFormSubmit()
    {
       document.getElementById("other_form").submit();
    }
</script>

<form action="resend_multiple_invoices.php" name="invoices_form" method="post">

    //
    // Input fields go here
    //

    <input type="button" onclick="invoicesFormSubmit()" value="Send Invoices" />
</form>

<form action="other_method.php" name="other_form" method="post">

    //
    // Input fields go here
    //

    <input type="button" onclick="otherFormSubmit()" value="Other Method" />
</form>

JQuery.ajax and html for validating an "inner form" through ajax, then submitting the entire form. I use ajax in both cases to show the purpose of a controller.php file and a submission id. You could also have an inner form which consists of several segregated sections by using classes instead of ids as Jquery selectors.

<form>
    <input />
    <textarea />
    <select /> <!-- etc. -->
    <section id="verify">
        <input />
        <textarea />
        <select /> <!-- etc -->
        <button type="button">submit</button>
        <!-- eg. sub-submission verifies data in section -->
    </section>
    <select />
    <input />
    <input type="submit" value="submit" />
</form>
<script>
$(document).ready(function() {

   $("#verify button").on ('click', verify);
   $('form').submit (formSend);

   function verify (){
       // get input data within section only (ie. within inner form)
       var postData = $('#verify').filter(':input' ).serializeArray();
       postData.push ({name:"submitId", value:'verify'});
       var request = $.ajax ({
          type: "POST",
          url: "controller.php",
          data: postData,
          error: function (xhr, status, message){
             alert (status);
          }
       });
   }
   function formSend (){
       // get input data within entire form
       var postData = $(this).serializeArray();
       postData.push ({name:"submitId", value:'send'});
       var request = $.ajax ({
          type: "POST",
          url: "controller.php",
          data: postData,
          error: function (xhr, status, message){
             alert (status);
          }
       });
   }
});
</script>