Quote:
Originally Posted by windsorben
Any idea what going wrong? Interestingly, if I change Post to Get, it works the first time. Here's the code:
<cfparam name="PageNum_display" default="1">
<cfparam name="URL.grade" default="0">
<cfparam name="URL.subject" default="0">
<cfparam name="FORM.grade" default="0">
<cfparam name="FORM.subject" default="0">
<cfquery name="display" datasource="abc">
SELECT *
FROM ActivityTable
WHERE grade =
<cfqueryparam value="#URL.grade#" cfsqltype="cf_sql_numeric"> AND subject =
<cfqueryparam value="#URL.subject#" cfsqltype="CF_SQL_VARCHAR">
</cfquery>
Here's the form:
<form name="form1" method="post" action="activitydisplay.cfm?grade=<cfoutput>#Form. grade#</cfoutput>&subject=<cfoutput>#Form.subject#</cfoutput>">
I know the code isn't perfect so please be kind.
The url scope is for GET and the form scope is for POST.
Your form is coded incorrectly for what you require. The reason why the GET request works first time is that you are sending a GET request by passing the values in the URL.
For a POST method, try the following for your form
[HTML]<input type="text" name="grade" value="">
<input type="text" name="subject" value="">[/HTML]
This will pass your values in a POST request.
Finally, your query must use the form scope for a POST request:
[HTML]<cfquery name="display" datasource="abc">
SELECT *
FROM ActivityTable
WHERE grade =
<cfqueryparam value="#FORM.grade#" cfsqltype="cf_sql_numeric"> AND subject =
<cfqueryparam value="#FORM.subject#" cfsqltype="CF_SQL_VARCHAR">
</cfquery>
[/HTML]