我有一个单选按钮,可以选择两个值。 M或Z.事情是,每个人都可以工作,但我不认为它识别变量,因为无论我把它放入'else'它都会被执行。因此,当我按提交时,即使我选择值为M或Z的按钮,我也会得到$ type = X和$ sir = 90的结果。
$submission = WPCF7_Submission::get_instance();
if ( $submission ) {
$first_name = $submission->get_posted_data("first-name");
$last_name = $submission->get_posted_data("last-name");
$email = $submission->get_posted_data("email-838");
$radio = $submission->get_posted_data("radio-474");
}
if($radio == M) {
$type = 'X';
$sir = '50';
} elseif ($radio == Z) {
$type = 'X';
$sir = '70';
}
else {
$type = 'X';
$sir = '90'; }
答案 0 :(得分:0)
当我使用fpdf和联系表单7时,我只能使用$_POST[''];
来获取变量的值所以如果你尝试
$submission = WPCF7_Submission::get_instance();
if ( $submission ) {
$first_name = $_POST['first-name'];
$last_name = $_POST['"last-name'];
$email = $_POST['email-838'];
$radio = $_POST['radio-474'];
}
if($radio == M) {
$type = 'X';
$sir = '50';
} elseif ($radio == Z) {
$type = 'X';
$sir = '70';
}
else {
$type = 'X';
$sir = '90'; }
它可能适合你。