Ok, i am beginning to see. I am looking at the cfloop list in the docs.
So I need to replace the 'form.fieldname' with the actual field 'list'? How
can I replace that with the name of 'list' since it is incrementing from the
form?
Do I need to rename my fieldname in the form from list#i# to something
static?
Ok, i am beginning to see. I am looking at the cfloop list in the docs.
So I need to replace the 'form.fieldname' with the actual field 'list'?
How can I replace that with the name of 'list' since it is incrementing
from the form?
Do I need to rename my fieldname in the form from list#i# to something
static?
NO, you just need to put all the pieces together.
Look at the <cfdump var="#form#"> you posted earlier.
struct
EMAIL wmkolcz@avemarialaw.edu
FIELDNAMES LIST1,LIST2,EMAIL,UPDATE
LIST1 9999
LIST2 1
UPDATE Update Subscription List
See the third line, there is a "field" named "FIELDNAMES" and it
contains a list of all the fields that where submitted by the form page.
<cfloop list="#form.fieldnames#" index="field">
This is going to loop over the list in the form.fieldnames key
[LIST1,LIST2,EMAIL,UPDATE] and put each list value into the variable
"field".
<cfif left(field,4) EQ "LIST">
This checks the value of the variable "field" in each loop to see if it
starts with the string "LIST" thus this is one of the list check box fields.
VALUES ('#form.email#', #form[field]#)
This inserts the values of form.email and the list field into the
database. In each loop itteration #form[field] is going to resolve to
form[LIST1] and form[LIST2] which in turn will resolve to the following SQL
VALUES ('#form.email#', #form[field]#
VALUES ('wmkolcz@avemarialaw.edu', 1)
VALUES ('wmkolcz@avemarialaw.edu', 9999)
Wally Kolcz - 29 Sep 2006 16:41 GMT
Now I get it. I had one small error that was causing a problem, but I fixed
that. And it works like a charm.
Thank you very very much for being patient with me and helping me. Now I
understand it.