<select name="country[]" multiple="multiple" id="type" class="medium" style="width:20%;height:300px;">
<option value="United States">United States</option>
<option value="Canada">Canada</option>
<option value="United Kingdom">United Kingdom</option>
<option value="Australia">Australia</option>
<option>---------------------------------</option>
{foreach from=$country key=id item=n}
{foreach from=$cntry key=i item=name}
<option value="{$n}" {if $name == $n}SELECTED{/if}>{$n}</option>
{/foreach}
{/foreach}
</select>
For some reason, it’s repeating every country I have in an array list 4 times, and it isn’t selecting the ones from $cntry that match the ones in $country.
$cntry (selected countries from rows in the DB), while $country is just an array list of all the countries.
You can try this way: