I have this hook in my functions.php:
add_action( 'wpcf7_mail_sent', 'myfunction' );
I want to post the values when the form is sent.
I have a field like this: [textarea your-message]
.
How do i capture the POST data from this?
for example when the form is sent i want to echo the post value of [textarea your-message]
in myfunction(){}
Database for Contact Form 7 is a productivity add-on to save all form submissions into your database. Without this plugin, you have to check each and every email to manually copy and keep the data you want.
There's no additional setting up needed — the submissions you get through Contact Form 7 will be stored in the wp_posts database. If you want to see them, you can head over to the newly added Flamingo tab on your website's dashboard. There, you'll notice the “Address Book” and the “Inbound Messages” options.
WordPress plugin contact form database in wordpress go to “CRM Entries” menu then select your form, plugin will show all entries in table form.
This is how I used and its work for me to receive contact form 7 data after successe mail send and I used this data to send another server through API
add_action( 'wpcf7_mail_sent', 'your_wpcf7_mail_sent_function' );
function your_wpcf7_mail_sent_function( $contact_form ) {
$title = $contact_form->title;
$submission = WPCF7_Submission::get_instance();
if ( $submission ) {
$posted_data = $submission->get_posted_data();
}
if ( 'Reagistation' == $title ) {
$name = strtolower($posted_data['text-name']);
$name = strtolower(str_replace(' ', '_', $name));
$email = strtolower($posted_data['email']);
$phone = strtolower($posted_data['phone']);
$Areyouarealtor = $posted_data['Areyouarealtor'];
$ayor = strtolower($Areyouarealtor['0']);
}
}
Try this :
add_action( 'wpcf7_sent', 'your_wpcf7_function' );
function your_wpcf7_function( $contact_form ) {
$title = $contact_form->title;
$submission = WPCF7_Submission::get_instance();
if ( $submission ) {
$posted_data = $submission->get_posted_data();
}
if ( 'MyContactForm' == $title ) {
$firstName = $posted_data['first-name'];
$lastName = $posted_data['last-name'];
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With