为什么我复选框的数据提交不上去
if ($this->request->isPost()) {提交后名字能写入数据库,但城市没有写入。 类型设置的是 text
// 表单数据
$data = $this->request->post();
if (Db::name('user')->insert($data)) {
$this->success('新增成功', 'index');
} else {
$this->error('新增失败');
}
}
$city = ['1' => '广州', '2' => '北京', '3' => '上海'];
return ZBuilder::make('form')->setPageTitle('添加')
->addText('name', '姓名')
->addCheckbox('city', '城市', '选择城市', $city,'')
->fetch();
没有找到相关结果
已邀请:
1 个回复
dolphinphp
赞同来自: laozhu1986