1 回答
TA贡献1859条经验 获得超6个赞
尝试这样做,因为您的复选框作为数组返回。你正在做的是定义它是否有价值,这是某种东西。
此外,应该使用CF7 Docs方法而不是对象的值来获取联系表单 7 对象
/* Don't do this, since id property is no longer accessible. */
$id = $contact_form->id; // Wrong.
/* Use id() method instead. */
$id = $contact_form->id();
更新功能
function serviceform( $contact_form ) {
// Use function id(); to get id of object $contact_form
if ( '8371' !== $contact_form->id() ) return;
$submission = WPCF7_Submission::get_instance();
if ( $submission ) {
$posted_data = $submission->get_posted_data();
}
$name = $posted_data['fullname'];
$carmodel = $posted_data['carmodel'];
$mobno = $posted_data['mobno'];
// Checkbox is returned as array. Check if empty.
$next_service_date_chk = !empty($posted_data['next_service_date_chk'][0]) ? true : false;
if($next_service_date_chk == true){
$message1 = urlencode("custome message one");
}
else{
$message1=urlencode("custome message two");
}
//sms to customer
file_get_contents('http://hpsms.dial4sms.com/api/v4/?api_key=xxxxxxxxxxxxxxxxxxxxx&method=sms&message='.$message1.'&to='.$mobno.'&type=2&sender=XXXXXX');
}
而不是这个
$next_service_date_chk =$posted_data['next_service_date_chk'];
- 1 回答
- 0 关注
- 113 浏览
添加回答
举报