As many of you viewing this may know there is always a right way to do something and a wrong way to do something. So I've come here to see if I could maybe seek some guidance.
What I have done is create a dynamic set of form fields (I can add and remove rows of fields using two buttons), this is centered within a huge main form (this is only one small part). I am honestly thinking of submitting this stuff as an array, however throughout my hours of research on how to properly do this I see everywhere saying you shouldnt submit text inputs as arrays. This part of the form is laid out as follows:
Datetime | Name | Quantity | Phone Number | Status
The datetime field is currently a text input, I will be upgrading that soon to be a calender picker to ensure that data is submitted to the mySQL database in the appropriate format and to make it a bit more user friendly. The name, quantity, and phone number fields are also text inputs, while the status field is actually a drop-down select input.
Now there are other form elements surrounding this "centralized" area of the form. Currently submitting the form sends the majority of the data I have to one mysql table in the database (including a unique identifier). The data in the part of the form described above will actually be going to a second data table (along with the same unique identifer). This way when I search the unique identifer in theory the form data will be filled in using data from both table which is tied together with that unique identifer. The idea behind this is that the main part of the form will be one single entry in the main mySQL table, while this dynamic form data might result in 1-30+ mySQL data rows within its own table.
So now that you hopefully have an idea of the setup of the form, my question is this....if I name each form input kinda like this:
<tr> <td><input name="datetime" type="text"></td> <td><input name="name" type="text"></td> <td><input name="quantity" type="text"></td> <td> <select name="status"> <option value="" selected="selected">--</option> <option>Confirmed</option> <option>Cancel</option> </select> </td> </tr>
And make an array out of the data, will this work? Is this (submitting it as an array) the best way to do it? I have been fooling around with it for three days now and have been encountering alot of problems. I am tempted just out of frustration to scrap the dynamic form fields and just make a maximum of 20 fields which are display:none'd via CSS and giving each individual form input its own name.