title: How do you save form data into database before submitting
body: <p>I am trying to save my form data into a wordpress database before submitting it. Please help. Heres my code and the php code to insert into database:</p>
  
  <pre><code>&lt;form method="post" action="https://app.icontact.com/icp/signup.php" name="icpsignup" 
  
  id="icpsignup1030" accept-charset="UTF-8" onsubmit="return verifyRequired1030();"&gt;
  &lt;input type="hidden" name="redirect" value="http://www.123.com/thank-you.html"&gt;
  &lt;input type="hidden" name="errorredirect" value="http://www.123.com/error.html"&gt;
  &lt;input type="hidden" name="listid" value="16360"&gt;
  &lt;input type="hidden" name="specialid:16360" value="MA3A"&gt;
  
  &lt;input type="hidden" name="clientid" value="1259610"&gt;
  &lt;input type="hidden" name="formid" value="1030"&gt;
  &lt;input type="hidden" name="reallistid" value="1"&gt;
  &lt;input type="hidden" name="doubleopt" value="0"&gt;
  &lt;input type="text" name="fields_email" size="21" style="padding:5px;"&gt;
  &lt;input type="image" name="submit" src="signup button top.png" value="" height="32px"&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>And the code to insert into DB:</p>
  
  <pre><code>&lt;?php   
      require_once('../../../wp-config.php');
      global $wpdb;
      $table_name = "icontact_emails";
      $email = $_POST[fields_email];
      if (trim($email) != ""){
      $wpdb-&gt;insert($table_name, array('email' =&gt; $email, 'timestamp'=&gt; date("Y- m-d h:i:s")));
      }
  ?&gt; 
  </code></pre>