• Hi there,

    When the contact form is submitted, I would like send email to the submitter and display only the values that are not zero. Also two different options for payment – one without service charge and one with. For that I need the “total” to calculate the two different numbers to send in email.

    How will I extract the values to do if statements and calculations?
    Thanks
    Subha

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Hi @spathial

    You can extract the values like this:

    add_action( 'wpcf7_before_send_mail', 'wpcf7_before_send_mail_fn', 10, 3 );
    function wpcf7_before_send_mail_fn( $contact_form, $abort, $submission ) {
    	$fields = $submission->get_posted_data();
    
    	$name = $fields['your-name'];
    	$email = $fields['your-email'];
    	$message = $fields['your-message'];
    
    	$to = $email;
    	$subject = 'Subject to submitter';
    	$message = 'Message to submitter';
    
    	// send mail to submitter
    	wp_mail( $to, $subject, $message );
    }
Viewing 1 replies (of 1 total)

The topic ‘get the values passed during submit’ is closed to new replies.