Call a PHP function from submit
-
Hi,
I have a function in functions.phpfunction 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)
Viewing 1 replies (of 1 total)
The topic ‘Call a PHP function from submit’ is closed to new replies.