Title: Call a PHP function from submit
Last modified: July 3, 2019

---

# Call a PHP function from submit

 *  Resolved [subhamkotnala](https://wordpress.org/support/users/subhamkotnala/)
 * (@subhamkotnala)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/call-a-php-function-from-submit/)
 * Hi,
    I have a function in functions.php
 *     ```
       function updateHasReadFlag($user) {
         // I added support for using this function either with user ID or user object
         if ( $user && is_int( $user ) ) {
           $user_id = $user;
         } else if ( ! empty( $user->ID ) ) {
           $user_id = $user->ID;
         } else {
           return;
         }
         return update_user_meta( $user_id, 'GDPR_TERMS_READ', true );
       }
       ```
   
 * Now I want to call this function on click of the Accept button from the GDPR 
   pop up.
 *     ```
       <form method="post">
                   <?php if ($isshortcode == 1) : ?>
                   <input type="hidden" name="wptp_popup_id" value="<?php echo $termspageid; ?>" />
                   <?php endif; ?>
       			<div class="tthebutton">
       				<input class="termsagree" name="wptp_agree" type="submit" value="<?php echo $tagree; ?>" />
       			    <input class="termsdecline" type="button" onclick="window.location.replace('<?php echo $termsRedirectUrl ?>')" value="<?php echo $tdisagree; ?>" />
       			</div>
       		</form>
       ```
   
 * How can I do that?

Viewing 1 replies (of 1 total)

 *  Plugin Author [Link Software LLC](https://wordpress.org/support/users/linksoftware/)
 * (@linksoftware)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/call-a-php-function-from-submit/#post-11702018)
 * As I mentioned in a previous thread, this forum is meant for supporting bugs 
   and issues with the plugin and not for PHP tutorials on how to extend its functionality.
   If WP Terms Popup doesn’t fit your needs you should consider finding another 
   popup solution or creating your own from scratch.

Viewing 1 replies (of 1 total)

The topic ‘Call a PHP function from submit’ is closed to new replies.

 * ![](https://ps.w.org/wp-terms-popup/assets/icon-256x256.gif?rev=2788347)
 * [WP Terms Popup - Terms and Conditions and Privacy Policy WordPress Popups](https://wordpress.org/plugins/wp-terms-popup/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-terms-popup/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-terms-popup/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-terms-popup/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-terms-popup/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-terms-popup/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Link Software LLC](https://wordpress.org/support/users/linksoftware/)
 * Last activity: [6 years, 11 months ago](https://wordpress.org/support/topic/call-a-php-function-from-submit/#post-11702018)
 * Status: resolved