Sistema de administración de clientes: almacenamiento de varios formularios

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

---O---

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.

preguntado el 24 de agosto de 12 a las 08:08

1 Respuestas

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 con el futuro bebé table for clients and a sus hijos 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.

Respondido 24 ago 12, 09:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.