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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search a dollar range 2

Status
Not open for further replies.

kpierson

Technical User
Jul 13, 2000
9
0
0
US
I'm stumped. I have a dropdown box for a range of dollar values ($0-$500, $501-$1000 etc.)in a dropdown box. Probably a mistake but I assigned each one a number value 1,2,3 etc. name is rugprice. I am at a loss how to search the data (rug) and show (price) of the rugs that fall within that range. The search page will have multiple ways to search (type, size and price). Any help on searching a range of numbers from a dropdown box would be appreciated.
 
search.htm (cfm)<br>----------------<br>&lt;form action=&quot;searchres.cfm&quot; method=&quot;post&quot;&gt;<br>&lt;select name=&quot;rugprice&quot;&gt;<br>&lt;option value=-1&gt;please select&lt;/option&gt;<br>&lt;option value=1&gt;$0-$500&lt;/option&gt;<br>&lt;option value=2&gt;$501-$1000&lt;/option&gt;<br>&lt;option value=3&gt;$1001-$1500&lt;/option&gt;<br>&lt;/select&gt;<br>&lt;input type=&quot;submit&quot;&gt;<br>&lt;/form&gt;<br><br>searchres.cfm<br>-------------<br>&lt;cfswitch expression = &quot;#form.rugprice#&quot;&gt;<br>&lt;CFCASE value = &quot;1&quot;&gt;<br> &lt;CFSET low = 0&gt;<br> &lt;CFSET high = 500&gt;<br>&lt;/cfcase&gt;<br><br>&lt;CFCASE value = &quot;2&quot;&gt;<br> &lt;CFSET low = 501&gt;<br> &lt;CFSET high = 1000&gt;<br>&lt;/cfcase&gt;<br><br>&lt;CFCASE value = &quot;3&quot;&gt;<br> &lt;CFSET low = 1001&gt;<br> &lt;CFSET high = 1500&gt;<br>&lt;/cfcase&gt;<br><br>&lt;!--- etc //---&gt;<br><br>&lt;/cfswitch&gt;<br><br>&lt;CFQUERY name=&quot;search&quot; datasource=&quot;your db&quot;&gt;<br> select *<br> FROM tablename<br> WHERE rugprice between #low# and #high#<br>&lt;/CFQUERY&gt;<br><br>&lt;CFOUTPUT QUERY=&quot;search&quot;&gt;<br>#rugprice#&lt;br&gt;<br>&lt;/cfoutput&gt;<br><br>webron
 
Thank you!!! That worked just great and was what I was needing. I am very impressed with the amount of help I have seen given on this site and the fact that the volume of message is just about the right size. Hate wading though 300 messages and that isn't even two days worth, would rather have fewer message that are of much higher quality.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top