Hi Guys,
I am back with another CF question for you.
I am trying to use the <CFSELECT> tag with no real success so far... I am using it in a form (drop-down menu) and I would like after the user selects an option for details of that selected option to be displayed on the next (post) page. This seems simple to do in theory to me but I just cannot put it into practice.
I have an idea that it requires that an ID be passed from the first page to the second but I cannot get it to work. In my database, I have all of the fruits listed with information for each of them, such as number_of_calories, color, vitamin_content, etc. I would like for the second page to display these details depending on what the user selects. I have created a template for the second page and I would like for the database to just "spit out" information to this template using CFOUTPUT.
Here is the sample code:
______________________________________________________________
This is what the Second Page should look like:
Fruits ----
----APPLE----
Number of Calories: approximately 75 per apple
Color: Red
Vitamin Content: Vitamin A, B, C, and D
______________________________________________________________
Thanks for any help at all!
Chinyere![[afro2] [afro2] [afro2]](/data/assets/smilies/afro2.gif)
I am back with another CF question for you.
I am trying to use the <CFSELECT> tag with no real success so far... I am using it in a form (drop-down menu) and I would like after the user selects an option for details of that selected option to be displayed on the next (post) page. This seems simple to do in theory to me but I just cannot put it into practice.
I have an idea that it requires that an ID be passed from the first page to the second but I cannot get it to work. In my database, I have all of the fruits listed with information for each of them, such as number_of_calories, color, vitamin_content, etc. I would like for the second page to display these details depending on what the user selects. I have created a template for the second page and I would like for the database to just "spit out" information to this template using CFOUTPUT.
Here is the sample code:
Code:
Here is my QUERY:
<CFQUERY NAME="get_fruit" DATASOURCE="fruits">
SELECT * FROM fuitdatabase
WHERE fruit_ID = "fruit_ID"
</CFQUERY>
______________________________________________________________
Code for First Page:
<CFFORM ACTION="details_page.cfm" METHOD=Post>
<CFSELECT name="fruit">
<option value="Select Your Fruit">Select Your Fruit
<option value="Apples">Apples
<option value="Oranges">Oranges
<option value="Grapes">Grapes
</CFSELECT><BR><BR>
<INPUT TYPE="hidden" NAME="#fruit_ID#" VALUE="#fruit_ID#">
<INPUT TYPE="Image" Name="Point" SRC="cdrh\images\submit.gif" border="0">
</CFFORM>
______________________________________________________________
Code for Second Page
<CFQUERY NAME="get_fruit" DATASOURCE="fruits">
SELECT * FROM fuitdatabase
WHERE fruit_ID = "fruit_ID"
</CFQUERY>
CFOUTPUT QUERY="get_fruit">
<TABLE WIDTH="100%" Cellpadding="0" Cellspacing="0" BORDER="1">
<TR>
<TD colspan="2">
<H2>Fruits ----</H2></TD>
</TR>
<TR>
<TD colspan="2">
<H2>----APPLE----</H2></TD>
</TR>
<TR>
<TD>
<B>Number of Calories:</B> </TD><TD>#form.number_of_calories#</TD>
</TR>
<TR>
<TD><B>Color:</B></TD> <TD>#form.color#</TD>
</TR>
<TR>
<TD><B>Vitamin Content:</B></TD> <TD>#form.vitamin_content#</TD>
</TR>
</TABLE>
This is what the Second Page should look like:
Fruits ----
----APPLE----
Number of Calories: approximately 75 per apple
Color: Red
Vitamin Content: Vitamin A, B, C, and D
______________________________________________________________
Thanks for any help at all!
Chinyere
![[afro2] [afro2] [afro2]](/data/assets/smilies/afro2.gif)