Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. <?php
  2. function prefix_send_email_to_admin() {
  3. global $wpdb;
  4. $inputValue = $_POST['playerName'];
  5. $scoreValue = $_POST['playerScore'];
  6. $dateValue = $_POST['curDate'];
  7. $wpdb->insert(
  8. 'highScore',
  9. array(
  10. 'playerName' => $inputValue,
  11. 'playerScore' => $scoreValue,
  12. 'playDate' => $dateValue
  13. ),
  14. array(
  15. '%s', // if the field type is string
  16. '%d', // if the field type is integer ('%f' would be float)
  17. '%s', // if the field type is string
  18. )
  19. );
  20.  
  21. echo $playerName;
  22.  
  23. // Sanitize the POST field
  24. // Generate email content
  25. // Send to appropriate email
  26.  
  27. wp_redirect( home_url('/game') );
  28. exit;
  29.  
  30. }
  31. add_action( 'admin_post_nopriv_contact_form', 'prefix_send_email_to_admin' );
  32. add_action( 'admin_post_contact_form', 'prefix_send_email_to_admin' );
  33.  
  34.  
  35.  
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement