>i have a problem passing variables to an edit page, it passes the field
>pol_question fine but for the answer fields my loop is incorrect, it just
>reproduces the answers 5 times each. each answer is the ans_answer table is
>related to the pol_question through the pol_id, any help would be
>appreciated

It appears that your query loops are resetting the value of 'ans_Ans' &
'ans_ID' each through each iteration; therefore the value for each will end
up set to the last value in the query each time.

You might try using an index loop instead of a query loop, like so:

<!--- start replacement loop code --->
<cfLoop from="1" to="#GetPollDetails.recordCount#" index="i">
   <!--- create a name for the current ans (i.e. 'Ans1') based on loop
index --->
   <cfSet currAns = 'Ans' & i>
   <!--- assign current ans a value from matching query index --->
   <cfSet '#currAns#' = getPollDetails.ans_Ans[i]>
   <!--- create a name for hidden form tag based on loop index --->
   <cfSet currAnsID = 'ans_id' & i>
 <input type="hidden" name="#currAnsID#" value="#getPollDetails.ans_id[i]#">
</cfLoop>
<!--- end replacement loop code --->

This will replace all 5 of the loops in your current setup.  A possible side
benefit of this is that it'll create the variables for every row in the
current query; of course, this might not be what you want, if your query is
actually selecting a couple hundred rows...

The rest of your output should remain the same.

HTH....

Brandon Whitaker
[EMAIL PROTECTED]
-------
"It'll get used by the same people using Opera.  People dressed in black
wearing berets."
- Dave Watts, on Mozilla

"It makes you feel so welcome to have a greeter like Papa Dave at the door.
Kind of like what Wal-Mart wishes it could do."
- John Allred, on Dave Watts

"The net interprets censorship as damage and routes around it."
- John Gilmore


------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to