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(){}
You need to access the $WPCF7_ContactForm
object.
In your hooked function, you'd access the field you want like this:
yourFunction(&$WPCF7_ContactForm) {
$text_area_contents = $WPCF7_ContactForm->posted_data['your-message'];
}