Thanks, Daniel, for the code.  It works better, but it only returns 4 jokes
even tho 5 were chosen in the joke form.  Please advise what I should do.
Thanks.

Hubert
----- Original Message -----
From: Daniel Wm Brick III <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 25, 2000 8:56 AM
Subject: RE: Problem controlling output


> The name of the field returned by your SELECT statements is 'a', not
> 'JokeTitle'.
> Since all of your SELECT statements are named 'a', then your values will
be
> returned in FORM.a as a list of JokeIDs.
> In other words, FORM.a will be '1,3,9,15,4' or something similar.
> In order to output a joke for each JokeID, you'll have to loop through the
> list and query the database for each JokeID, as detailed in this
> modification of your form action template:
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>
> <HTML>
> <HEAD>
>  <TITLE>JokeAction</TITLE>
> </HEAD>
>
> <BODY>
> <cfloop index="MyIndex" list="#FORM.a#" delimiters=",">
> <CFQUERY DATASOURCE="Jokes" NAME="JokeData">
> SELECT Joke
> FROM WordJokes
> WHERE JokeID=#MyIndex#
> </CFQUERY>
>
> <CFOUTPUT QUERY="JokeData">#Joke#</CFOUTPUT>
> </cfloop>
>
> </BODY>
> </HTML>
>
>
> Hope this works for you.  Good luck!
> dBIII+
>
>
> -----Original Message-----
> From: Hubert Earl [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 25, 2000 2:18 AM
> To: [EMAIL PROTECTED]
> Subject: Problem controlling output
>
>
> Hi,
>
> I'm having a problem controlling the output of a form.  I have a form
which
> allows the user to choose up to 5 joke titles from a joke database, and a
> form action template which should result in the output of just those 5
> jokes, the titles of which were chosen on the form.  However, the entire
> database gets output.  I've pasted the code of the form and action
template
> below.  Please advise me.
>
> The form code:
>
> <CFQUERY
> DATASOURCE="Jokes"
> NAME="Titles">
>
> SELECT JokeID, JokeTitle
> FROM WordJokes
> ORDER BY JokeTitle
> </CFQUERY>
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>
> <html>
> <head>
>  <title>Jokes</title>
> </head>
>
> <body>
>
> <h1>JOKES</h1>
>
> <FORM ACTION="jokesaction.cfm" METHOD="POST">
>
> Please select joke titles from the contents of the select boxes below.
You
> may select up to five titles at a time.<P>
>
> Joke title #1:
> <SELECT NAME="a">
> <OPTION>
>   <CFOUTPUT QUERY="Titles">
> <OPTION VALUE="#JokeID#">#JokeTitle#
> </cfoutput>
> </select><P>
>
> Joke title #2:
> <SELECT NAME="a">
> <OPTION>
>   <CFOUTPUT QUERY="Titles">
> <OPTION VALUE="#JokeID#">#JokeTitle#
> </cfoutput>
> </select><P>
>
> Joke title #3:
> <SELECT NAME="a">
> <OPTION>
>   <CFOUTPUT QUERY="Titles">
> <OPTION VALUE="#JokeID#">#JokeTitle#
> </cfoutput>
> </select><P>
>
> Joke title #4:
> <SELECT NAME="a">
> <OPTION>
>   <CFOUTPUT QUERY="Titles">
> <OPTION VALUE="#JokeID#">#JokeTitle#
> </cfoutput>
> </select><P>
>
> Joke title #5:
> <SELECT NAME="a">
> <OPTION>
>   <CFOUTPUT QUERY="Titles">
> <OPTION VALUE="#JokeID#">#JokeTitle#
> </cfoutput>
> </select><P>
>
> <INPUT TYPE="submit" VALUE="Submit choice(s)">
> <INPUT TYPE="reset" VALUE="Clear">
>
> </FORM>
> </body>
> </html>
>
> --------------------------------------------------------------------------
--
> ------------------------------------------
>
> The form action template:
>
> <CFQUERY
> DATASOURCE="Jokes"
> NAME="JokeData">
> SELECT Joke
> FROM WordJokes
> WHERE JokeTitle=JokeTitle
> </CFQUERY>
>
>
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>
> <HTML>
> <HEAD>
>  <TITLE>JokeAction</TITLE>
> </HEAD>
>
> <BODY>
>
> <CFOUTPUT QUERY="JokeData">#Joke#</CFOUTPUT>
>
> </BODY>
> </HTML>
>
> ---
> Hubert Earl
> ICQ#:  16199853
>
> I develop & maintain web sites internationally.  I also build web
> applications using CGI scripts written in Perl.  I accept subcontracting
> work.
>
> **Personal web site:  http://www.geocities.com/SiliconValley/Peaks/8702/
> (please remember to view this with a sense of humour!)
>
> **Business web page:  http://home.talkcity.com/MigrationPath/hearl/
>
>
>
> --------------------------------------------------------------------------
----
> Archives: http://www.eGroups.com/list/cf-talk
> 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.

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
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.

Reply via email to