Question
Passing form variables to a template page.
I created a form page which passes a form variable name
'orderNo'. When it hits the action page a <cfif>
statement deduces whether it has been used and exists in a database record. The <cferror> than
send the user to the (cferror assigned template page). I would like the user to see the form.orderNo variable they entered on the template page.
Code inside action page which test the form variable against records
<!--- query the database to find a match for the form variable 'orderNo'--->
<cfquery name="GetMatch" datasource="dbMHAM">
SELECT OrderNo
FROM tblMham
WHERE OrderNo = <cfqueryparam value="#form.orderNo#" cfsqltype="CF_SQL_LONGVARCHAR">
</cfquery>
<!--- if the record count for the order number is '0' then request the template
page to provide information to the user about the number already existing
in a record of the database--->
<cfif GetMatch.recordCount GT 0>
<cferror type = "request" template= OrderNo_ValidationPage.cfm>
<cfabort showerror="order number already used">
Template page output
<cfoutput>#orderNo#</cfoutput> you entered is found in a posted record.<br>
Hit the<strong> Internet explorer back button</strong> review the survey and enter a new number<br>
or edit the with the same order number you tried to use
Text
statement deduces whether it has been used and exists in a database record. The <cferror> than
send the user to the (cferror assigned template page). I would like the user to see the form.orderNo variable they entered on the template page.
Code inside action page which test the form variable against records
<!--- query the database to find a match for the form variable 'orderNo'--->
<cfquery name="GetMatch" datasource="dbMHAM">
SELECT OrderNo
FROM tblMham
WHERE OrderNo = <cfqueryparam value="#form.orderNo#" cfsqltype="CF_SQL_LONGVARCHAR">
</cfquery>
<!--- if the record count for the order number is '0' then request the template
page to provide information to the user about the number already existing
in a record of the database--->
<cfif GetMatch.recordCount GT 0>
<cferror type = "request" template= OrderNo_ValidationPage.cfm>
<cfabort showerror="order number already used">
Template page output
<cfoutput>#orderNo#</cfoutput> you entered is found in a posted record.<br>
Hit the<strong> Internet explorer back button</strong> review the survey and enter a new number<br>
or edit the with the same order number you tried to use
Text
