简体   繁体   English

获取联系表格7单选按钮的值

[英]Get value of contact form 7 radio button

favorite I have following radio buttons in contact form 7 and a few text fields and hidden fields. 最喜欢的是,我有以下联系表单7中的单选按钮,以及一些文本字段和隐藏字段。

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

Following are a few example lines of code in functions.php. 以下是functions.php中的一些示例代码行。 I am able to get all the other values eg 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? 有没有办法获取所选单选按钮的值?

好的,这样我就可以通过页面上的javascript获取单选按钮的值,并将其值分配给表单中的隐藏字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM