Answer the question
In order to leave comments, you need to log in
What fields are coming?
Faced with a problem with which we have been tinkering for a considerable time. Suppose there is a form for creating something, it has mandatory fields, and which the user can create himself. The user provides us with the field names as he generated them in his HTML.
e.g. data[name], data[email], data[messege] or field[name], field[email], field[messege] or field[value][name], field[value][email], field[value ][email]
names are dynamic and there is no possibility to influence them, but it is possible to learn them.
How can we make a system for converting fields through the API into the values \u200b\u200bthat we need automatically knowing the name of the field and knowing which key to attribute to in the database?
Answer the question
In order to leave comments, you need to log in
This is done very simply, create a params table (id int, name varchar(255), value varchar(255))
After saving the required fields in the table (for example, items), get the id (from the items table), and write all the values \u200b\u200bto the params table which the user has created by linking them to the form (items) via id.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question