User configurable forms with php and mysql

The online application that we create (php and mysql) requires that users can create their own forms for collecting data and write this data to the database, observing existing ORMs.

If the forms are hardcoded, we simply set up db tables to maintain normalized data, however, since our users define the form fields contained in the forms, we are not sure which is the best way to start implementing this function.

Do we need to think about some kind of metadata or data abstraction layer for our database? Google did not help much, since we are not sure how we need to do this.

Any pointers in the right direction would be greatly appreciated!

+4
source share
2 answers

Many content management systems solve this problem in different ways.

For example, in Drupal, users can create their own custom content (with custom forms) through the CCK module . The module defines various types of fields that the user can create, and then generates tables with specific data types for storing data.

Some tips:

  • Define field types . Consider giving users a choice of different types of fields (e.g., select a field, line, radio).

  • Create tables for custom fields . Each field type will have a specific SQL data type. Define a table using these data types. For example, a select box can be matched with an enumeration, and a text input can be matched with a varchar column.

  • Add data to new tables - use new tables for some normal data storage.

Obviously, there are many different approaches, but these are just a few suggestions.

+1
source

I think I found a solution to my problem, so for all those people who come on a similar problem, look at the following articles -

http://www.adaniels.nl/articles/an-alternative-way-of-eav-modeling/

http://weblogs.sqlteam.com/davidm/articles/12117.aspx

Hope this helps.

+1
source

All Articles