nickyfraggle
01-01-2008, 08:21 PM
Hello,
I'd like to loop through a list of form elements posted to my php page, and insert their values into the database.
The form page contains a list of input fields, and is dynamic i.e. a back office allows them to add more information and therefore increase the list of inputs on my form page.
So what I think I need to do is loop through the posted values...assign them a name (which is be the name of the field they were posted from)...and then insert them into the database. If a field is blank...I don't want it to be inserted...I only want to insert fields with something in them.
Each posted value is added to the database seperately. They are parts.
So, in my database, I store the part name, the ID (to tell me where it came from) and the posted value. The part name is the name of the field that the value was posted from. SO...I'd need to store the name of the field it was posted from...together with the value within that field...and insert them both into the database together (but into seperate fields!)
I think this could prob be done each time the loop went through and got the posted values & name of text field. Each time it looped through it would get the input name, it's posted value and insert it into the database.
Anyone have any ideas? That's if I haven't confused you completely....it's pretty much scrambled my brain just trying to get it all down on paper for you!
Thanks!
Nicola
I'd like to loop through a list of form elements posted to my php page, and insert their values into the database.
The form page contains a list of input fields, and is dynamic i.e. a back office allows them to add more information and therefore increase the list of inputs on my form page.
So what I think I need to do is loop through the posted values...assign them a name (which is be the name of the field they were posted from)...and then insert them into the database. If a field is blank...I don't want it to be inserted...I only want to insert fields with something in them.
Each posted value is added to the database seperately. They are parts.
So, in my database, I store the part name, the ID (to tell me where it came from) and the posted value. The part name is the name of the field that the value was posted from. SO...I'd need to store the name of the field it was posted from...together with the value within that field...and insert them both into the database together (but into seperate fields!)
I think this could prob be done each time the loop went through and got the posted values & name of text field. Each time it looped through it would get the input name, it's posted value and insert it into the database.
Anyone have any ideas? That's if I haven't confused you completely....it's pretty much scrambled my brain just trying to get it all down on paper for you!
Thanks!
Nicola