S.Faraji S.Faraji - 1 year ago 61
HTML Question

How do I populate a combobox from an array in PHP?

I want to have an simple array in php and a combobox in html.

// Here is my array:

Answer Source

Code in php page :

$smarty->assign('cars', $cars);

Smarty code for HTML page(Template page):

<select name="car">
  {foreach from=$cars item=car}
    <option value="{$car}">{$car}</option>