title: Custom form in WordPress and store values into custom database
body: <p>I have a simple form with 2 text fields in my WordPress site. I created a new page template and added the following HTML code:</p>
  
  <p>This is the HTML:</p>
  
  <pre><code>&lt;form action="&lt;?php the_permalink(); ?&gt;" id="customform" method="post"&gt;
  Field 1: &lt;input type="text" name="field1" id="field1"&gt;
  Field 2: &lt;input type="text" name="field2" id="field2"&gt;
  &lt;input type="submit" name="submit" id="submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Now all I want to achieve, is that whatever the user inputs, it stores it to <code>mySQL</code> (<strong>which is in the same database as WordPress</strong>), in the table <code>test_form</code>, for example.</p>
  
  <p>How do I achieve this? </p>