Populating drop down menu with iniitials if checkbox is checked in database
I am trying to populate a drop down menu with a user's initials that I have in my database, but it has to depend if the "Received_By_Initials" column is checked. I tried putting an If statement in the loop query on the drop down, but it doesn't seem to work. This code I'm using is on an edit page, so that's why I have the selected code on here too because I would like to have the initials display in the drop down if they are already chosen from before. The reason I want to do this is because I have a lot of different drop downs I'm going to use these initials for and I don't want to create multiple tables for Received By, Assigned By, RFQ Leader, etc. Does anyone know how to fix this so this will work? Here's the code:
<CFQUERY NAME="ShowReceivedByInitials" Datasource="#application.DataSource#">
SELECT Initials, Received_By_Initials
From Users
Order by Initials
</CFQUERY>
<select name="Initials">
<option value="">Select Initials</option>
<cfloop query="ShowReceivedByInitials">
<option value="#Initials#"
<cfif #ShowReceivedByInitials.Received_By_Initials# EQ "1">selected</cfif>>#Initials#
</cfloop>
</select>
Thanks.
Andy
