I need to store data that has been sent from multiple forms - the fun bit is, as these forms will be created by a form builder I am planning on giving users access to, I have no idea how many fields will be in the form, or how many fields the user will be submitting. I have thought about a table structure similar to the following (the form itself is saved as php for include):
| FormId | FormType | InputID | InputType | LongText | Text | Date |
FormId is relevant to another table storing location of the form file etc for include (e.g below), Input ID is relevant to the input on the page.
| FormId | FormType | PathToForm | DateCompleted |...etc
input "a" from formId 1 might look like:
<input id="a" name="a" type="text" value="example"/>
whereas input "a" from formId 2 might look like:
<textarea name="a" id="a"></textarea>
Which I can write into a table like this:
| FormId | FormType | InputID | InputType | LongText | Text | Date |
--------------------------------------------------------------------------
| 1 | 1 | a | text | NULL | example | NULL |
| 2 | 2 | a | textarea | example | NULL | NULL |
The number of "inputs" on each form is potentially unlimited - the inputs on different form templates may be of different "type" each time.
My question (finally!) - is this the best way I can be doing this? I know storing output of a form, per line, isn't exactly ideal - however without having hundreds of tables and, without loosing the possibility of pulling the data usefully should I ever need to in the future (by "FormType") I'm not sure of any other way to structure. Not really come across anything like this before, sorry if it sounds silly!