Title: Run PHP code after successful submit
Last modified: August 22, 2016

---

# Run PHP code after successful submit

 *  [traone](https://wordpress.org/support/users/traone/)
 * (@traone)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/run-php-code-after-successful-submit/)
 * I would want to run some php code after the submission has been validated and
   use some of the submission field values in my code.
 * I understand this could be done with javascript “on_sent_ok”, but for security
   reasons, I would prefer to do things server side.
 * Is there an action hook that I could use to achieve this, that also passes validated
   form values?
 * [https://wordpress.org/plugins/contact-form-7/](https://wordpress.org/plugins/contact-form-7/)

Viewing 1 replies (of 1 total)

 *  [Djules](https://wordpress.org/support/users/djules/)
 * (@djules)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/run-php-code-after-successful-submit/#post-5251029)
 * You can use the filter _wpcf7\_validate_, once all fields have been validated.
 *     ```
       function post_validate( $result ) {
         ...
       }
       add_filter( 'wpcf7_validate', 'post_validate' );
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Run PHP code after successful submit’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Djules](https://wordpress.org/support/users/djules/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/run-php-code-after-successful-submit/#post-5251029)
 * Status: not resolved