I have following radio buttons in contact form 7 and a few text fields and hidden fields.

[radio radio id:radio label_first "3" "6" "9" "12"]

Following are a few example lines of code in functions.php. I am able to get all the other values e.g text fields and hidden fields but not radio buttons.

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

    if ($submission) {
        $posted_data = $submission->get_posted_data();
    }
$txt = $posted_data['txt'];
        $text2 = $posted_data['txt2'];
$radio=$posted_data['radio']; 
}

Is there a way to get the value of selected radio button?

Read more here: Get value of contact form 7 radio button


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: