title: javascript Submit multiple forms with one button
body: <p>In my html I have multiple forms (text inputs, radio buttons, check boxes and select) and one button. I would like to fill all these forms and send values to my php file. For now I am trying to submit values from text input and select but I am stuck at this point.</p>
  
  <p>I have a js submit file:</p>
  
  <pre><code> submitForms = function(){
    document.getElementById("form1").submit();
    document.getElementById("form2").submit();
   }
  </code></pre>
  
  <p>And my forms are like this:
  SELECT:</p>
  
  <pre><code> &lt;form id ="form1" name="dists" action="solve.php" method="post"&gt;
          &lt;select id="demo" name="sadzba" onchange="selectElement1(this.value)&gt;
                  &lt;option value=""&gt;-- vyberte oblasť --&lt;/option&gt;
          &lt;/select&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>Text input form + button:</p>
  
  <pre><code> &lt;form id="form2" action="solve.php" method="post"&gt;
      &lt;input type="text" name="spotVT" &gt;&lt;label&gt;kWh za rok VT&lt;/label&gt;
      &lt;div id="nt" style='display:none'&gt;&lt;input type="text" name="spotNT"  &gt;&lt;label&gt;kWh za rok NT&lt;/label&gt;&lt;/div&gt;
  
      &lt;/form&gt;
   &lt;input id="sub" type="button" value="Ok" style="margin-left:15px;" onclick="submitForms()"/&gt;
  </code></pre>
  
  <p>But this is not working. Can you help me please? Thank you</p>