0

I'm currently writing a pretty complex PHP administration system for a startup web design/SEO company. This system allows our techs to manage clients more efficiently and clients to track the progress of their project.

One feature is the ability for our techs to assign forms for the client to fill out with their information, and this form data to be stored in their Client Admin for future reference and editing.

Of course, each project/offered package is different, so forms that may be required for one client, are not required for another, but all in all, there will probably be 8-10 different forms that can be assigned.

My question is, would it be better for the data of each form to be saved in a different table that corresponds with the Client's specific ID, or should I write the form data to client/form specific .txt files, and retrieve the data from those files? For example:

Client #1132 fills out form1 -> Create table "1132_form1" -> Insert form data

Client #1132 fills out form 2 -> Create table "1132_form2" -> Insert form data

---OR---

Client #1132 fills out form 1 -> Create form1.txt in "users/1132/forms" -> Write form data to form1.txt

Client #1132 fills out form 2 -> Create form2.txt in "users/1132/forms" -> Write form data to form2.txt

If you have a better idea that is completely outside of these options, please let me know.

1 Answer 1

0

You're thinking about this all wrong. You should look into the basics of relational DB design and normalization. What you're looking for is a parent table for clients and a child table for forms. Very basic example:

**Clients** 
client_id INT(11) PRIMARY KEY
client_name TEXT


**Forms**
form_id INT(11) PRIMARY KEY
client_id INT(11) (will correspond to the client_id in the Clients table)
form_location TEXT (location of the form on disk. i.e. the location of it on your server)

Having this DB design will allow you to have multiple forms for each client.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.