如何解决Cakephp Mail Project多个复选框
我正在研究Cakephp 3项目。我希望我的用户可以将邮件发送给多个收件人。我正在面对问题,我无法一次插入多个复选框的值。PLz帮助我。谢谢你英语不好。
控制器代码
style="word-spacing: 30px;"
表单代码
/**
* Add method
*
* @return \Cake\Http\Response|null Redirects on successful add,renders view otherwise.
*/
public function add()
{
$this->loadModel("Users");
$OrganizationId = $this->Auth->user(['OrganizationId']);
$Users = $this->Users->find('all');
$this->set('Ulist',$Users);
$usernamer = $this->Auth->user(['username']);
$senderId = $this->Auth->user(['PId']);
$mail = $this->Mail->newEntity();
if ($this->request->is('post')) {
$this->request->data['Date'] = date("Y/m/d");
$this->request->data['Sender'] = $usernamer;
$this->request->data['SenderId'] = $senderId;
$this->request->data['Type'] = $senderId;
$mail = $this->Mail->patchEntity($mail,$this->request->getData());
if ($this->Mail->saveMany($mail)) {
$this->Flash->success(__('The mail has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The mail could not be saved. Please,try again.'));
}
$this->set(compact('mail'));
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。