Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function prefix_send_email_to_admin() {
- global $wpdb;
- $inputValue = $_POST['playerName'];
- $scoreValue = $_POST['playerScore'];
- $dateValue = $_POST['curDate'];
- $wpdb->insert(
- 'highScore',
- array(
- 'playerName' => $inputValue,
- 'playerScore' => $scoreValue,
- 'playDate' => $dateValue
- ),
- array(
- '%s', // if the field type is string
- '%d', // if the field type is integer ('%f' would be float)
- '%s', // if the field type is string
- )
- );
- echo $playerName;
- // Sanitize the POST field
- // Generate email content
- // Send to appropriate email
- wp_redirect( home_url('/game') );
- exit;
- }
- add_action( 'admin_post_nopriv_contact_form', 'prefix_send_email_to_admin' );
- add_action( 'admin_post_contact_form', 'prefix_send_email_to_admin' );
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement