I am new to SFMC. Trying to populate the dropdown list from a DE through Ampscript.
I am trying this code. Any help is appreciated.
Data DE Name: testcompname
Column Name: company_name
Sending DE Name: test_seed
Column Names: email_id
, org_name
%%[
var @compname, @compname_rows
SET @compname_rows = lookupRows("testcompname", "compname", @company_name)
SET @compname = Lookup(@testcompname, "key", "company_name")
%%[ if @compname_rows > 0 then ]%%
<select name="">
<option value="">Select</option>
%%[ for @i = 1 to @compname_rows do ]%%
<option value="%%=v(@compname)(@i)=%%">%%=v(@compname)(@i)=%%</option>
%%[ next @i ]%%
</select>
%%[ else ]%%
<br>Options not found
%%[ endif ]%%
]%%