Watch out the code below:
add_action( 'wpcf7_before_send_mail', 'm2sys_action_wpcf7_sent' );
function m2sys_action_wpcf7_sent($args)
{
global $wpdb, $wp;
$submission = WPCF7_Submission::get_instance();
if ( $submission ) {
$posted_data = $submission->get_posted_data();
}
$first_name = isset($posted_data['your-name']) ? $posted_data['your-name'] : 'Name not found';
$data = 'Your name:' . $first_name;
update_option( 'cf7_data', $data );
}
add_action( 'wpcf7_before_send_mail', 'm2sys_action_wpcf7_sent' );
function m2sys_action_wpcf7_sent($args)
{
global $wpdb, $wp;
$submission = WPCF7_Submission::get_instance();
if ( $submission ) {
$posted_data = $submission->get_posted_data();
}
$first_name = isset($posted_data['your-name']) ? $posted_data['your-name'] : 'Name not found';
$data = 'Your name:' . $first_name;
update_option( 'cf7_data', $data );
}