Hi, i need to create a dynamic drop down menu..
i want to select from the DB all the species that are for sale.
I then want to display each species name in the drop down menu once.
PHP FILE
$query = $this->db->execute('SELECT `species` FROM `table1`');
$species = Array();
if ($this->db->numRows($query) > 0)
{
while($l = $this->db->fetch($query))
{
$species[] = $l;
}
}
$this->tpl->assign('species', $species);
$this->tpl->display('Market.tpl');
SMARTY TEMPLATE
{if $species}
<select name="Species">
{foreach from=$species item=species}
<option value="{$species}">{$species}</option>
{/foreach}
</select>
{/if}