Quantcast
Channel: Adobe Community : Unanswered Discussions - ColdFusion
Viewing all articles
Browse latest Browse all 5794

Form not filtering results

$
0
0

I'm creating 2 filtering drop downs and I can't figure out why my code isn't filtering the results on the page.  Please help...

 

Here's the code.

<cfparam name="form.personnel" default="">

<cfparam name="form.status" default="">

 

<cfquery name="q" datasource="#dsn#">

     SELECT *

     FROM table

     WHERE 1=1

          <cfif val(form.personnel) GT 0>

               AND Sector = <cfqueryparam value="#form.personnel#" cfsqltype="cf_sql_varchar">

          </cfif>

          <cfif val(form.status) GT 0>

               AND reqStatus = <cfqueryparam value="#form.status#" cfsqltype="cf_sql_varchar">

          </cfif>

</cfquery>

 

<form method="post" action="">

     <select name="personnel">

               <option></option>

     </select>

     <select name="status">

               <option></option>

     </select>

     <input type="submit" />

</form>

 

<cfoutput query="q">

     #sector# || #reqstatus#

</cfoutput>


Viewing all articles
Browse latest Browse all 5794

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>