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 關注
- 133 瀏覽
添加回答
舉報