PatrickMacC
asked on
dynamically building a select statement in coldfusion.
Working away on a little CRM type tool and I am a little stumped.
here is the issue I have.
Page1.cfm
asks for number of lines to work with (called portnum)
Calls page2.cfm portnum is passed over in a session variable
I loop on the form to show a input field for each line
my issue is how to write it out to the sql after the person enters the details. I am thinking that i build the insert string in writelines.cfm on the fly. Am I right in this thinking or is their an easier way ?
thanks
here is the issue I have.
Page1.cfm
asks for number of lines to work with (called portnum)
Calls page2.cfm portnum is passed over in a session variable
I loop on the form to show a input field for each line
<cfloop from="1" to="#session.portingfields.portnum#" index="counter">
<cfoutput>
<cfinput type="text" name="number_#counter#" value="" size="8"><br>
</cfoutput>
</cfloop>
and it calls writelines.cfm on submitmy issue is how to write it out to the sql after the person enters the details. I am thinking that i build the insert string in writelines.cfm on the fly. Am I right in this thinking or is their an easier way ?
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
#form.fieldnames# to get the fieldnames
e.g.
<cfloop item="fname" collection="#form#">
<cfoutput>#fname# - #form[fname]#<br></cfoutpu
</cfloop>
Use this information to build select statement