get value of radio button cf7 code example

Example: get posted data from radio button cf7

function wpcf7_cstm_function($contact_form) {
    $title = $contact_form->title;
    $submission = WPCF7_Submission::get_instance();

    if ($submission) {
        $posted_data = $submission->get_posted_data();

        $txt = isset($posted_data['txt'])?$posted_data['txt']:'';
        $text2 = isset($posted_data['txt2'])?$posted_data['txt2']:'';
        $radio = isset($posted_data['radio'][0])?$posted_data['radio'][0]:'';

        // do something with your data
    }
}
add_action("wpcf7_before_send_mail", "wpcf7_cstm_function");

Tags:

Misc Example