|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Hi,
I have a form that has multiple input boxes on the one page (ie under same form tag)...I need to collect the form data in one submit but the data from each input box needs to go into the db as a new record (ie a new row). Can anyone provide me with a nice clean way of doing this? Thank you. |
|
#2
|
|||
|
|||
|
Just loop over the form fields and within the loop execute the insert statement. You'll get one insert for each iteration of the loop.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#3
|
|||
|
|||
|
Hi Kiteless,
You don't have an eg of this about anywhere do you? |
|
#4
|
|||
|
|||
|
Just as an example, if the forms were "customer1", "customer2", and "customer3", you'd do something like:
<cfloop list="#form.fieldNames#" index="thisField"> <cfif left( thisField, 8 ) eq "customer"> <cfquery name="insertCustomer" datasource="myDSN"> insert into Customers ( customerName ) values( '#form[thisField]#' ) </cfquery> </cfif> </cfloop> |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Inserting to a DB multiple entries |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|