title: add onclick function to a submit button
body: <p>I'm just learning javascript and php.  I created a contact form and I'd like the submit button to accomplish two things when I press it:</p>
  
  <ol>
  <li>submit the data to me (this part is working)</li>
  <li>read my onclick function (this part is not working)</li>
  </ol>
  
  
  
  <pre><code>&lt;input id="submit" name="submit" type="submit" value="Submit" onclick="eatFood()"&gt;
  
  &lt;?php
  if ($_POST['submit']) {
   ////????? 
  }
  ?&gt;
  </code></pre>
  
  <p>I'm sending the data to my email, and so I get that.  But the <code>onclick</code> function doesn't seem to work.  I tried reviewing <a href="https://stackoverflow.com/questions/5356011/add-onclick-function-for-submit-button">add onclick function for submit button</a> but it didn't help.</p>