title: Run a PHP function before submit is made using WordPress submit_button()
body: <p>I'm creating an options page in WordPress admin interface. How can I run a PHP function before a submit is made?</p>
  
  <p>My HTML:</p>
  
  <pre><code>&lt;div class="wrap"&gt;
  &lt;h2&gt;Author&lt;/h2&gt;
  &lt;form method="post" action="options.php"&gt;
      &lt;?php settings_fields('author_option_group'); ?&gt;
      &lt;h4&gt;Author Settings&lt;/h4&gt;
      &lt;label for="author"&gt;Author: &lt;/label&gt;
      &lt;input type="text" id="author" name="author" value="&lt;?php echo get_option('author'); ?&gt;" /&gt;
      &lt;?php submit_button(); ?&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p></p>
  
  <p>The <code>submit_button()</code> above is a wordpress function that generates a submit button that saves the input field to the wp options table in the database. I would like to run a function before the submit is run. The function will do some custom validation etc and maybe throw an error and not run the submit if certain conditions are met.</p>
  
  <p>Regardless of what that function will do, how can I supply a function to be run, which determines if the submit will go through or not?</p>