The correct Code is :

<cfloop index="counter" from="1" to="5" step="1">

        <!--- CHeck if Select Box is empty. If not then insert values,
otherwise loop again --->
        <cfif len(evaluate('EquipmentForm.chooseequip#counter#'))>

        
                <cfquery name="InsertEquipment" datasource="relora"
dbtype="Oracle80">
        
        
                        INSERT INTO tblEquipEntry 
                        
                        VALUES
(tblequipentry_seq.nextval,1000,'#Evaluate('EquipmentForm.chooseequip#co
unter#')#',#Evaluate('EquipmentForm.hours#counter#')#)
                        
                        </cfquery>
        
        </cfif>
        
        
</CFLOOP> --->

Thanks all.

-Gel


-----Original Message-----
From: Angel Stewart [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, November 21, 2001 3:06 PM
To: CF-Talk
Subject: Looping through list of variables


Hey all.

I have a form with variables nammed chooseequip1,
chooseequip2,chooseequip3...5

Now I want to check if each of these is empty, and if not then insert
data.

Of course I need to reference them. I tried using a CFLOOP but I am
running into problems with referenceing the fields with evaluate.

<cfloop index="counter" from="1" to="5" step="1">

        <cfif len(evaluate('EquipmentForm.chooseequip#counter#'))>
                
                <cfquery name="InsertEquipment" dbtype="Oracle80">
        
        
                        INSERT INTO tblEquipEntry 
                        
                        VALUES
(tblequipentry_seq.nextval,1000,#Evaluate('#EquipmentForm.chooseequip##c
ounter#')#,#Evaluate
('#EquipmentForm.hours##counter#')#)
                        
                </cfquery>

        </cfquery>

</CFLOOP>


Any ideas on the correct way to reference those fieldvalues?

-Gel

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to