Hello. I'm having a problem trying to figure this one out. I want to have a
way for people to decide is they want the results of a search displayed
in a simple html format or an excel spreadsheet. Basically I have two
pages, one that lists the data with as plain html, and one that
generates an excel file. How can I add a check box on the submit form
that allows them to choose which one they want?
This is the code for the form:
<cfform action="htmlresults.cfm" method="post">
<CFINPUT type="checkbox" name="excel" value="true" tabindex="1"> Excel
Format<br><br>
<select name="search">
<OPTION SELECTED>List All Items
<OPTION>-----------------------
<OPTION>Armor
<OPTION>Amulets
<OPTION>Weapons
<OPTION>Rings
</select>
<cfoutput>
<cfif isdefined("excel") EQ "true">
<INPUT TYPE="BUTTON" VALUE="Checkout" onClick="location.href=
'excelresults.cfm'">
<CFELSE>
<INPUT TYPE="BUTTON" VALUE="Checkout" onClick="location.href=
'htmlresults.cfm'">
</cfif>
</cfoutput>
</cfform>
This is the query in excelresults.cfm and htmlresults.cfm
<cfquery name="results" datasource="d2list">
SELECT Count, Name, Defense, Durability, Requirements, Properties
FROM items
WHERE
count = '#trim(cfform.search)#' OR
type = '#trim(cfform.search)#'
ORDER by type
</cfquery>
Funny thing is that it worked just fine before I tried adding the option of
sending the search results to an excel spreadsheet. Now it tells me
that it's bombing out when it gets to #trim(form.search). Is the
problem with the line "location.href=""?? I read somewhere that
passing the search through a url would not work.
Any Ideas?
Thanks,
Patrick Mullins
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.