douzhoulei8959 2016-02-23 04:51
浏览 39
已采纳

如何使用PHP管理动态创建表单中的数据

The problem:
Create custom forms, and fields. Manage the Data;

I`m creating an CMS with PHP and Codeigniter. My client will need manage the form fields by itself. Because they can change... today will be around 20 fields. But next month will be 23.

I know how to make a logic to create the forms. But how can i manage the data?

Serialize the data and save in one field on table, will not be helpfull i think, because, how can i do a quick search/filter in table in serialized data?

Someone already got this problem? Maybe can help me build a small logic here to get a way to work.

Just in case someone asks, with Codeigniter, I`m able to do something like this:

$formData = $this->input->post();

and get something like this:

$formData = array(
 [fieldName] = 'Value',
 [fieldName2] = 'Value 2'
 [fieldName3] = 'Value 3'
);

So get the data, was easy.

  • 写回答

3条回答 默认 最新

  • doudou20145 2016-02-23 05:12
    关注

    This table structure for dynamically created form

    frm_fields table

    field_id
        field_title (the title that appears beside the field on the form)
        field_level (defines the level of the organisation at which the field is represented e.g. global or office level)
        field_view (defines which view the field relates to in the erp system used by the business)
        field_block (defines the block of fields it will appear in on the form)
        field_technicalName
        field_side (value is either 1 or 2 which defines whether it appears on the left or right of the 2 column block)
        field_type (defines whether it is a text, select, checkbox field etc.)
        field_length (defines the max character length of the field)
        field_width (defines the size of the field as it appears on the form)
    

    frm_active table

    form_id (each form request will of course have a unique id)
    field_id (foreign/primary key of the field from the table above)
    field_value (the value they have entered for this field)
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?