Q
Q
Quber2015-01-21 12:19:06
PHP
Quber, 2015-01-21 12:19:06

How to properly organize the structure of the form designer in the database?

It is necessary to implement a form constructor, for example, from the four most common types of fields:

input
textarea
checkbox
radio

Forms can be created an unlimited number and with high attendance without subsidence in the database.
My thoughts:
Create tables
Forms // название формы, описание и т.п., связана с Options
Options // Храним названия полей + связь с forms и типами полей
Inputs
Textareas 
Checkboxes
Radios

Accordingly, when outputting, select it all from the database, collect and display it on the screen.
Maybe there are other better options that I haven't thought of. For example, store everything in one table like that (arrays can) or collect forms in advance and collect them in one table as ready-made. don't even know.
UPD.
A colleague suggested that in the tables
Inputs
Textareas 
Checkboxes
Radios

Store only values. To store parameters (required or not to fill in, error text, etc.) use separate tables for each of the options. To avoid duplicate information.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DeFacto, 2015-01-27
@DeFacto

store as JSON and keep it simple

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question