title: How do I execute php function on submit button in a FORM similar to onsubmit=" return javascript function"?
body: <p>My goal: To process three objectives: 
  (1) Make insertion in a staging table before processing payment.
  (2) Go to third party payment processing site like paypal using my form action attribute.
  (3) Read the $_POST data from the payment landing page to determine if payment was successful and then take the data from the staging table and insert into real table. </p>
  
  <p>My desired implementation would sth like:</p>
  
  <blockquote>
  <pre><code>&lt;form name="demo" method="post" onsubmit="&lt;?php insertStagingData() ?&gt;"       action="3rdpartyPaymentProcessingLink"&gt; 
  &lt;input name ="Submit" type"submit" value"Submit"&gt; 
  &lt;/form&gt;
  </code></pre>
  </blockquote>
  
  <p>I know that the web browser executes the onsubmit handler and when the handler completes, the browser proceeds with the form submit. I have used this concept for java script client side validation before forwarding the form to web server for php processing. </p>
  
  <p>I dont know if this can be done when both handlers require server side processing, one on my webserver and the second on a 3rd party site. </p>
  
  <p>Thanks in advance for suggestions and help!</p>