I did this on a client's site - here's what I did:

(I know this can be done better- but it was quick and effective)

Hope this helps!

Query:
<cfquery name="qryGetARL" datasource="#datasource#" username="#username#"
password="#password#">
SELECT *
FROM ARL_Books

<cfif IsDefined("FORM.SearchARL") AND FORM.SearchARL EQ "1">
                WHERE #FORM.Type# Like "#FORM.SearchPhrase#%"
                ORDER BY Title ASC
<cfelse>

        <cfif IsDefined("URL.Term") AND #URL.Term# NEQ "">
                WHERE Title Like "#URL.Term#%"
                        <cfif IsDefined("URL.SORT")>
                                ORDER BY #URL.SORT# #URL.Order#
                        <cfelse>
                                ORDER BY Title ASC
                        </cfif>
        <cfelse>
                        <cfif IsDefined("URL.SORT")>
                                ORDER BY #URL.SORT# #URL.Order#
                        <cfelse>
                                ORDER BY Title ASC
                        </cfif>
        </cfif>
</cfif>
</cfquery>

Search Form:
<form action="<cfoutput>#CurrentPage#</cfoutput>" method="post"
name="searchBOOKS">
<strong>Search:</strong>
<select name="Type">
                  <option value="Title">Title</option>
                  <option value="Author">Author</option>
</select>
<input type="text" name="SearchPhrase" value="" size="20">
<input type="hidden" name="SearchARL" value="1">
<input type="submit" value="Go!" class="SubButtonOff"
onmouseover="this.className='SubButtonOn'"
onmouseout="this.className='SubButtonOff'"/>
</form>

Hardcoded Alphabet List:
<cfoutput>
<hr size="1" color="##990000">
By Title:&nbsp;&nbsp;
<a href="#CurrentPage#?Term=a">A</a> | <a href="#CurrentPage#?Term=b">B</a>
ETC... | <a href="#CurrentPage#?Term=">All</a>
<hr size="1" color="##990000">
</cfoutput>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:2313
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to