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 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思