| | |
insert loop
Please support our ColdFusion advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2008
Posts: 2
Reputation:
Solved Threads: 0
I am not sure how to ask the question, but here goes. I have a multiline survey storing data about a specific project. I want to store the data in the following fields:
proj_id
strat_issue
strat_goal
strat_obj
strat_value
here is an example of my code
This insert code only inserts the same value for all fields
Thanks
proj_id
strat_issue
strat_goal
strat_obj
strat_value
here is an example of my code
html Syntax (Toggle Plain Text)
<form action="strat_survey.cfm?update=gogo" method="post"> <table width="90%" border="1" cellpadding="3" cellspacing="0" bordercolor="#CCCCCC"> <tr> <td colspan="3" align="center"><strong><font color="#0000FF">Project Alignment with 2007-2010 STRATEGIC ISSUES, GOALS, AND OBJECTIVES</font></strong></td> <td><font size="2"><strong>Project Aligns with Objective</strong></font></td> </tr> <tr> <td colspan="3"><strong>Service Delivery - It is critical that we employ strategies to ensure excellent service delivery.</strong></td> <td> </td> </tr> <tr> <td width="2%"> </td> <td width="2%">1</td> <td width="86%">Develop a comprehensive Customer Service Action Plan to enhance the delivery of Department services.</td> <td width="10%"> </td> </tr> <tr> <td> </td> <td> </td> <td>1.1 Establish methods to continually assess internal and external customer satisfaction.</td> <td> <input type="checkbox" name="strat_value" value="1"> <input type="hidden" name="strat_issue" value="Service Delivery"> <input type="hidden" name="strag_goal" value="1"> <input type="hidden" name="strat_ob" value="1.1"></td> </tr> <tr> <td> </td> <td> </td> <td>1.2 Implement service level improvements to assist customers and improve efficiency and effectiveness. (wait times, credit cards)</td> <td> <input type="checkbox" name="value2" value="1"> <input type="hidden" name="strat_issue" value="Service Delivery"> <input type="hidden" name="strat_goal" value="1"> <input type="hidden" name="strat_obj" value="1.2"></td> </tr> </table>
This insert code only inserts the same value for all fields
coldfusion Syntax (Toggle Plain Text)
<cfquery name="strat_post" datasource="#request.dsn#"> INSERT INTO proj_strat_align (strat_issue,strat_goal,strat_obj,strat_value) values ('#form.strat_issue#','#form.strat_goal#','#strat_obj#','#strat_value#') </cfquery>
Thanks
Last edited by peter_budo; Apr 20th, 2008 at 7:52 pm. Reason: Keep It Organized - please use [code] tags
One thing to check is to cfdump the form structure and make sure that the data from the form is correct.
Do you have any <cfset> statements that could be over-writing the value of those form variables? If possible, please post the entire strat_survey.cfm page so we can look at it more thoroughly.
Thanks
ColdFusion Syntax (Toggle Plain Text)
<cfdump var="#form#">
Do you have any <cfset> statements that could be over-writing the value of those form variables? If possible, please post the entire strat_survey.cfm page so we can look at it more thoroughly.
Thanks
•
•
Join Date: Apr 2008
Posts: 2
Reputation:
Solved Threads: 0
Here are the results from the CFDUMP
struct
FIELDNAMES STRAT_VALUE,STRAT_ISSUE,STRAG_GOAL,STRAT_OBJ,VALUE2,STRAT_GOAL
SEARCHSTRING [empty string]
STRAG_GOAL 1
STRAT_GOAL 1
STRAT_ISSUE Service Delivery,Service Delivery
STRAT_OBJ 1.1,1.2
STRAT_VALUE 1
VALUE2 1
Here is how the data was stored
recnum; 22
recdate: 04/21/2008
blog_id:
strat_issue: Service Delivery,Service Delivery
strat_goal: 1
Strat_obJ: 1.1,1.2
strat_value: 1
I need it to update two records, like this
1.
recnum 1
recdate 04/21/2008
blog_ID
strat_issue Server Delivery
strat_goal 1
strag_obj 1.1
strat_value 1
2.
recnum 1
recdate 04/21/2008
blog_ID
strat_issue Server Delivery
strat_goal 1
strag_obj 1.2
strat_value 1
struct
FIELDNAMES STRAT_VALUE,STRAT_ISSUE,STRAG_GOAL,STRAT_OBJ,VALUE2,STRAT_GOAL
SEARCHSTRING [empty string]
STRAG_GOAL 1
STRAT_GOAL 1
STRAT_ISSUE Service Delivery,Service Delivery
STRAT_OBJ 1.1,1.2
STRAT_VALUE 1
VALUE2 1
Here is how the data was stored
recnum; 22
recdate: 04/21/2008
blog_id:
strat_issue: Service Delivery,Service Delivery
strat_goal: 1
Strat_obJ: 1.1,1.2
strat_value: 1
I need it to update two records, like this
1.
recnum 1
recdate 04/21/2008
blog_ID
strat_issue Server Delivery
strat_goal 1
strag_obj 1.1
strat_value 1
2.
recnum 1
recdate 04/21/2008
blog_ID
strat_issue Server Delivery
strat_goal 1
strag_obj 1.2
strat_value 1
•
•
Join Date: Oct 2005
Posts: 8
Reputation:
Solved Threads: 1
At first glance - looks like you have a typo:
name="strat_obj" ??
ColdFusion Syntax (Toggle Plain Text)
<input type="hidden" name="strag_goal" value="1"> <input type="hidden" name="strat_ob" value="1.1">
name="strat_obj" ??
Last edited by jamba; May 1st, 2008 at 9:14 am.
•
•
Join Date: Jul 2008
Posts: 2
Reputation:
Solved Threads: 0
ColdFusion Syntax (Toggle Plain Text)
('#form.strat_issue#','#form.strat_goal#','#strat_obj#','#strat_value#')
Why are you using 'form.value' and 'value' beter to just use al with form.xx
like :
ColdFusion Syntax (Toggle Plain Text)
('#form.strat_issue#','#form.strat_goal#','#form.strat_obj#','#form.strat_value#')
This can prevent some mistakes in your code.
http://www.besmartgoogleit.com/searc...on+form+values
![]() |
Similar Threads
- how to loop thru checked checkbox to retrieve its value?!? (ASP.NET)
- insert database (ColdFusion)
- need help asap :) (Java)
- do while loop - not stopping!! (Java)
- Subfolder Search Loop (Visual Basic 4 / 5 / 6)
- Link List Insert problems (C++)
- while loop question (Python)
- Array without twice the same number? (C)
- Need Help with "Please Insert Disk" message in Quark (Mac Software)
Other Threads in the ColdFusion Forum
- Previous Thread: does dreamweaver MX can create forum?
- Next Thread: navigation button
| Thread Tools | Search this Thread |





