Change <cfset TG =""> to <CFPARAM name="tg" default="">. Otherwise, you've clear TG before the second query.
-----Original Message----- From: Colin Coles [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 04, 2005 6:38 AM To: CF-Newbie Subject: Re: Form variable in a where clause [email protected] on Tuesday October 04 2005 at 11:33 +0000 wrote: >Start again. You have a drop down, when the user selects something from >this drop down you want the selected value to filter the results of >another query? Yes. Exactly. The code is a bit crude at the moment but is as follows: <cfform action="qAction.cfm" method="post"> <title>Out of College Activities On-Line Questionnaire</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="default_style.css"> <!--- <cfquery name="GetResponse" datasource="sports_qs"> SELECT responseType, value FROM tblYesNo </cfquery> ---> <cfquery name="GetTG" datasource="sports_qs"> SELECT tg FROM tblTg </cfquery> <cfset TG =""> <cfquery name="getName" datasource="sports_qs"> SELECT name, names_tg FROM tblNames WHERE names_tg = <cfqueryparam value='#getTG.tg#' cfsqltype="cf_SQL_VARchar"> </cfquery> </head> <body> <table class="text"> </table> <hr> <table width="600" cellpadding="0" cellspacing="0" class="text"> <tr> <td align="center">Out of School Club Participation Questionnaire</td> </tr> <tr> <td align="left">* please fill in all required fields</td> </tr> </table> <table width="100%" bgcolor="#CCCCCC" cellpadding="2" cellspacing="0" class="text"> <!--- Select Tutor Group from table in database ---> <tr> <td valign="top">Tutor Group:</td> <td colspan="2"> <cfselect size="1" name="TG" required="yes" class="smallform" message="Please select your tutor group."> <cfoutput query="GetTg"><option value="#GetTg.tg#">#GetTg.tg#</option></cfoutput> </cfselect> </td> </tr> <!--- Field: Select Name from List generated by variable TG above by filtering tblNames with that variable ---> <tr> <td valign="top">Name:</td> <td colspan="2"> <cfselect size="1" name="Name" required="yes" class="smallform" message="Please select your name from the list."> <cfoutput query="getName"><option value="#getName.name#">#getName.name#</option> </cfoutput> </cfselect></td> </tr> </table> <input type="submit" value="Submit" class="smallform"> <input type="reset" value="Reset" class="smallform"> <input type="submit" value="Cancel" class="smallform"> </cfform> Colin Coles ICT Development Manager John Cabot City Technology College Tel 0117 976 3000 Ext 2112 Mobile: 07734395347 E Mail: [EMAIL PROTECTED] Alt: [EMAIL PROTECTED] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:15:1407 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
