I'm trying to create a dynamic form creation function using PHP at the moment. I'm trying to make it as non-dependent as possible.
In doing this, I wanted to specify HTML input types in the database itself. I started with things like 'if varchar, then create a text field' type thing. But I realized that I would run into problems with radio button, check box, password and email fields.
Is there any way to create an attribute for the column that contains a number relating to another table that will specify what kind of input it will be?
Here's an example table setup:
id - email - password - first_name - last_name - gender - terms_accepted
Then I would have numbers relating to another table as attributes so it would be something like this:
id - email - password - first_name - last_name - gender - terms_accepted
null - 1 - 2 - 3 - 3 - 4 - 5
And the other table would be something like this:
type_id - type_name
1 = email
2 = password
3 = text
4 = radio button
5 = check box
Is something like this possible? or should I come back to reality? What would it look like if possible, and how would I execute such a structure?