Jump to content

How to retrieve items from Database to the list


albert_leung

Recommended Posts

Hi All. This is urgent. I am using Coldfusion to create the homepage. I want to retrieve the items from Database and those items are become my drop box for user select and send the selected item to another page. Could someone can help me how to write the HTML code or using other language with Coldfusion? I am a new guy for using HTML and Coldfusion. Thanks a lotAlbert

Link to comment
Share on other sites

<cfquery name="qryGetMyStuff" datasource="mydsn">SELECT *FROM mytablenameWHERE xxxx LIKE 'yyyyyy'</cfquery><cfform action="destinationpage.cfm" method="post">...<cfselect name="myoptions"><option value="">-- select one --<cfoutput query="qryGetMyStuff"><option value="field_key_value">field_display_name</cfoutput></cfselect>...</cfform>

Link to comment
Share on other sites

Thank you for your help. What if I want to load the data from the database and show it to the drop box automatically? Since I have many records and I would like to list one attribute in the drop box. For example, I would like to let the user choose the name of the animal and I retrieve the name from my database and show it to the drop box. Thank you so much.Regards

<cfquery name="qryGetMyStuff" datasource="mydsn">SELECT *FROM mytablenameWHERE xxxx LIKE 'yyyyyy'</cfquery><cfform action="destinationpage.cfm" method="post">...<cfselect name="myoptions"><option value="">-- select one --<cfoutput query="qryGetMyStuff"><option value="field_key_value">field_display_name</cfoutput></cfselect>...</cfform>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...