PHP after form submit?
-
I am trying to hook some functions after contact form submission. I have added this into the functions.php:
add_action( 'wpcf7_mail_sent', 'your_wpcf7_mail_sent_function' ); function your_wpcf7_mail_sent_function( $contact_form ) { $title = $contact_form->title; $posted_data = $contact_form->posted_data; if ( 'Free Evaluation' == $title ) { $Function = "CreateContact"; $FullName = $posted_data['your-name']; $Email = array( 0=>array( "Text"=>$posted_data['your-email'], "Type"=>"Personal" ) ); $Phone = array( 0=>array( "Text"=>$posted_data['tel-424'], "Type"=>"Mobile" ) ); $CustomFields = array( "Location (Required)"=>"Singapore" ); $Parameters = array( "FullName"=>$FullName, "Email"=>$Email, "Phone"=>$Phone, "CustomFields"=>$CustomFields ); $Result = CallAPI($Function, $Parameters); } }
The CallAPI function is also defined in functions.php
However, it seems
$posted_data['your-name'];
etc are not grabbing the form’s submitted values for me.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘PHP after form submit?’ is closed to new replies.