Codeigniter将属性添加到open_form_multipart

时间:2017-06-20 12:54:05

标签: php database forms codeigniter

我们有一个表格可以将产品添加到我们的数据库中。我们在open_form_multipart处有图片。我们认为问题在于它没有添加我们的属性。

错误:

  

错误号码:1048

     

列'product_foto'不能为空

     

INSERT INTO productsproduct_naamproduct_beschrijvingproduct_categorieophaal_plaatsproduct_fotodate_created,{{1 VALUES('','','','',NULL,'2017-06-20','2017-06-20')

     

文件名:models / Product_model.php

     

行号:9

我们的代码在视图中:

date_updated

1 个答案:

答案 0 :(得分:0)

您需要遵循定义表单的惯例。

Documentation

您的代码应为:

$arr = array('name' => 'product_foto');
echo form_open_multipart('', $arr);
  

form_open_multipart([$ action ='' [,$ attributes = array()[,$ hidden =   阵列()]]])

     

参数:

     

$ action(string) - 表单操作/目标URI

     

string $ attributes(array) - HTML属性

     

$ hidden(array) - An   隐藏字段数组的定义返回:HTML多部分表单   打开标签

     

返回类型:字符串

注意:操作设置为空白,以便表单提交到同一页面。