Question
Dynamic dropdown
I can't test this because I don't have a server running. But
I do want to know if this will work. I'm trying to populate a
dropdown based on another dropdown's value...
<select name="test_select">
<option selected value=""></option>
<option value="bill">bill</option>
<option value="john">john</option>
<option value="andy">andy</option>
</select>
<cfif IsDefined(#form.test_select#)>
<cfquery name="test_select" datasource="mydsn" maxrows="25">
SELECT id,first_name,last_name FROM my_db WHERE first_name = '#test_select#'
</cfquery>
<select name="first_name">
<cfoutput query="test_select">
<option value="#id#">#first_name# #last_name#</option>
</cfoutput>
</select>
</cfif>
<select name="test_select">
<option selected value=""></option>
<option value="bill">bill</option>
<option value="john">john</option>
<option value="andy">andy</option>
</select>
<cfif IsDefined(#form.test_select#)>
<cfquery name="test_select" datasource="mydsn" maxrows="25">
SELECT id,first_name,last_name FROM my_db WHERE first_name = '#test_select#'
</cfquery>
<select name="first_name">
<cfoutput query="test_select">
<option value="#id#">#first_name# #last_name#</option>
</cfoutput>
</select>
</cfif>
