I submitted this again because im not sure that it went through the first time.
I'm back with another question ( imagine that :)
First i would like to say thanks to everyone that has helped me so far a lot of things
have worked great!
what i have is a form that has 6 selection box's (all multiple select box's) which
list's all of the contestans in a circuit.
if i select just one person for each place 1st through 6th everything is great.
however when i need to select two for
a place (example: tie in first or something like that) im trying to get the insert
page to put each contestant on there own
row in the DB. rather than put a comma between the ContestantID's This is what i have
now but for some reason it still adds the
comma's and doesnt put them on there own row.
<!-- PART OF THE FORM.-->
<!-- The form feild that has the name "LoopList" looks like this -->
<input type="hidden" name="LoopList" value="1,2,3,4,5,6">
<!-- Then i have a form with 6 selection menues that look like this -->
<!-- I want to have the abilaty to select more than one of these on all 6 selection
menus and insert a differant row for each selected -->
<select name="Place1ContestantID" size="2" multiple>
<option value="">Select Contestant <cfoutput query="Contestants">
<option value="#ContestantID#">#LastName#, #FirstName# (#Age#)</cfoutput>
</select>
<!--THE INPUT PAGE -->
<!-- Adds Records To The DB. -->
<cfloop index="LoopList" list="#form.LoopList#">
<cfset RodeoID = #Form.RodeoID#>
<cfset EventID = #Form.EventID#>
<cfset Place = #LoopList#>
<cfset TimeTaken = #Evaluate("form.Place#LoopList#TimeTaken")#>
<cfset Points = #Evaluate("form.Place#LoopList#Points")#>
<cfset AdjPoints = #Evaluate("form.Place#LoopList#AdjPoints")#>
<cfset MoneyEarned = #Evaluate("form.Place#LoopList#MoneyEarned")#>
<cfset NotAllAround = #Evaluate("form.Place#LoopList#NotAllAround")#>
<cfset ListCheck = #ListLen("form.Place#LoopList#ContestantID")#>
<!-- If Form only has 1 entry for each place 1st through 6th (NO TIES) -->
<!-- Adds a row for each Contestant Selected in form -->
<cfif ListCheck EQ 1>
<cfset ContestantID = #Evaluate("form.Place#LoopList#ContestantID")#>
<cfquery name="PutResults" datasource="#datasource#" username="#username#"
password="#password#" dbtype="ODBC">
INSERT INTO ResultsManager (RodeoID, EventID, ContestantID, Place, TimeTaken, Points,
AdjPoints, MoneyEarned, NotAllAround)
VALUES (
'#RodeoID#',
'#EventID#',
'#ContestantID#',
#Place#,
#TimeTaken#,
#Points#,
#AdjPoints#,
#MoneyEarned#,
#NotAllAround#)
</cfquery>
<cfelse>
<!-- If Form has more than on entry for any of the places 1st through 6th ex: a tie in
first OR second ect... -->
<!-- Should enter a new row for each ContestantID that is selected in the multiple
select box's -->
<!-- rather than adding a comma ',' between their ID Number in the same row -->
<cfloop index="LoopContestantID" list="#form.Place#LoopList#ContestantID#">
<cfset ContestantID = #LoopContestantID#>
<cfquery name="PutResults" datasource="#datasource#" username="#username#"
password="#password#" dbtype="ODBC">
INSERT INTO ResultsManager (RodeoID, EventID, ContestantID, Place, TimeTaken, Points,
AdjPoints, MoneyEarned, NotAllAround)
VALUES (
'#RodeoID#',
'#EventID#',
'#ContestantID#',
#Place#,
#TimeTaken#,
#Points#,
#AdjPoints#,
#MoneyEarned#,
#NotAllAround#)
</cfquery>
</cfloop>
</cfif>
</cfloop>
Thanks,
Jay Patton
Web Design / Application Design
Web Pro USA
406.549.3337 ext. 203
1.888.5WEBPRO
www.webpro-usa.com
[EMAIL PROTECTED]
**********************************
"Trust Everyone....
But Always Cut The Cards."
**********************************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists