Submitting more than 8000 textfields
Posted: Wed Aug 27, 2008 2:56 pm
Hi everyone, I am having some problems with a small webpage I made. Let me explain first what it is about so that you get a better idea of what I'm doing.
There are supervisors in the company, each supervisor has about 20 employees at his/her command, and each supervisor must evaluate each of the employees that they have on different "Skills" that each employee has. In total, there are 205 skills to evaluate (In a scale of 0-5) for each employee. Now What I did was writte the 205 skills automatically generated from a database with a textfield so the supervisors can enter the evaluation for each employee, and also they must enter in another textfield the minimum evaluation that each employee should have.
So, in average we have a total of 8200 textfields inside a form.
When supervisors finally finish evaluating their employees, they click on a SAVE button and what I do is submit the form to another page and there I do the following:
- I get the list of skills from the database
- For each skill I get the list of employees that the supervisor has from the DB
- For each skill, I do a to get the value that they typed in the textfield for each skill, the textfield name is composed of the ID of the skill and the employee number, to have 8200 unique textfield names.
- After getting the textfield value, I run a query to insert or update that value into the database, so in total there are 8200 queries to be executed to the DB (I know, it is a waste of memory...)
Now here is my problem, some times users are able to save their information correctly without any problems, but some times only Half of their evaluations is saved, and when that happens I get angry calls from them hahahha
I don't really know what may be the problem, do you think is the fact that I run a single query for each value from the form??
Any ideas on how to make my code more efficient or to avoid having loses of information when saving the information?
Thanks!
There are supervisors in the company, each supervisor has about 20 employees at his/her command, and each supervisor must evaluate each of the employees that they have on different "Skills" that each employee has. In total, there are 205 skills to evaluate (In a scale of 0-5) for each employee. Now What I did was writte the 205 skills automatically generated from a database with a textfield so the supervisors can enter the evaluation for each employee, and also they must enter in another textfield the minimum evaluation that each employee should have.
So, in average we have a total of 8200 textfields inside a form.
When supervisors finally finish evaluating their employees, they click on a SAVE button and what I do is submit the form to another page and there I do the following:
- I get the list of skills from the database
- For each skill I get the list of employees that the supervisor has from the DB
- For each skill, I do a
Code: Select all
$_REQUEST['textfield_employee_Skill_ID']- After getting the textfield value, I run a query to insert or update that value into the database, so in total there are 8200 queries to be executed to the DB (I know, it is a waste of memory...)
Now here is my problem, some times users are able to save their information correctly without any problems, but some times only Half of their evaluations is saved, and when that happens I get angry calls from them hahahha
I don't really know what may be the problem, do you think is the fact that I run a single query for each value from the form??
Any ideas on how to make my code more efficient or to avoid having loses of information when saving the information?
Thanks!