Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Same Form Submitted Multiple Times (or Not)

Status
Not open for further replies.

jrbjr5

Programmer
Apr 2, 2004
2
US

I have a form that I want to fill out and complete "x" times. x is passed from the previous page via a FORM variable. I have set the form up in a <CFLOOP>. Currently I am seeing "x" copies of the form on my page. I wanted to see the form once and then submit it and then see it again (x times) and submit it. In other words I want to submit the form "x" number of times.

The concept is to track attendance. How many visitors did you have (x) ? Then submit (name, address, etc.) to the visitor table "x" times.

Any thoughts ?
James

 
You could use a hidden form field to track the number of forms to display. Then decremement it when you submit.

USE THIS ON THE DISPLAY PAGE:
<cfoutput>
<cfparam name="FORM.numForms" default="1">
<form name=... action=... method="Post">
<input name="numForms" type="Hidden" value="#FORM.numForms#">
...
Other form fields
...
</form>
</cfoutput>


THEN USE THIS ON THE ACTION PAGE:
<cfparam name="FORM.numForms" default="1">
Do your DB insert here

<!--- Decremement the counter --->
<cfset FORM.numForms = FORM.numForms - 1>
<cfif FORM.numForms GT 1>
redirect back to the FORM page again
<cfelse>
redirect back to some main page
</cfif>


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top