title: How to make a href act as a submit form
body: <p>So I have a <code>a href</code> setup as a simple form submit, but I wanted to use it as the same type of method as  a submit on a form.</p>
  
  <p>So the way I have it setup is:</p>
  
  <pre><code>&lt;!-- HTML --&gt;
  &lt;a onclick="subForm('login');" style="cursor: pointer;"&gt; login &lt;/a&gt;
  
  // JavaScript
  function subForm(el) {
    var elem = document.getElementById(el);
    elem.submit();
  }
  </code></pre>
  
  <p>Now when I click on that link it does act as if I have clicked submit on a form, I can set up a <code>input type=hidden</code> for the form so I can see it in PHP but..</p>
  
  <p>I needed for this login system to not be empty and didn't want to use the older method with <code>if empty</code> then display an error after processed, so I wanted the submit button to be able to do the <strong>same as clicking submit on a form when one of the inputs are set to <code>required</code> in their markup tag..</strong></p>