如何解决提交 0 如果复选框被选中,否则提交 1
我有相反的情况。我有复选框,如果未选中,我想提交值 1,如果选中,则提交值 0。
我的第一个要求很好。我可以打印 1 如果我的复选框未被选中但如果我的复选框被选中我会变空(这里我想打印 0)但我变空了:
我的代码:
function registerAtSalesforce($first_name,$communication){
$data = [
'userInput' => [
'FirstName' => $first_name,'UserName' => $email,'MarketingCommunicationOptOut' => $communication ? false : true,]
];
}
我正在调用的函数 registerAtSalesforce 如下:
function uos_account_register_form_submit($form,&$form_state) {
if(variable_get('sf_auth') === 1{
registerAtSalesforce($form_state['values']['firstname'],$form_state['values']['ublox_communication'][1]); // This field "ublox_communication" of checkbox
}
}
我使用的是 drupal 7。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。