I have a dropdown list which allows multiple selections. A user can choose as many of the items they want. Upon submission, it writes those choices in a single form field as a comma separated list. The dropdown list field is called KEYWORDS.
So, my question is how do I take what they chose originally from the database and repopulate the KEYWORDS dropdown list with the choices they made originally.
As it stands, the values in the database are
So when I go to reload the page form with only those options chosen from that KEYWORDS dropdown field, I want those highlighted.
I write this in CF and think I need to use a CFLOOP "List" but don't know how to do that when the KEYWORDS dropdown is being populated from a query result already.
SELECT keyword FROM keywords
<select name="keywords" id="keywords">
I know that I can put a CFIF statement in there to "select" it, but I don't know how to write the cfif statement and where i can compare it to the database results from before which is "option8,option14,option28
I think I need to compare option 8 first then option14 then option 28, etc. I just don't know how to write the conditional cfloop and how to nest it in the code.