I have two combobox : "<select> </select>" from database.
one combobox depends on another combobox.I have a problem with the connection between the two.
The first combobx :
in tpl file :
<select onchange=" " name="id">
<option value="Select">Select</option>
{foreach from=$categories item=categorie}
<option value="$id = {$categorie.id_category}" {if $smarty.id}selected = "selected"{/if}>{$categorie.id_category}</option>
{/foreach}
</select>
in Controller.php
public function initContent()
{parent::initContent();
$categories = Db::getInstance()->ExecuteS('
//my sql
');
$this->context->smarty->assign('categories',$categories);
//$this->context->smarty->assign('souscategories',$souscategories);
$this->setTemplate(_PS_THEME_DIR_.'mytpl.tpl');
}
The seconde combobx:
When the customer choose the category, retrieve the id of this class and run the seconde query
$id=Tools::getValue('id');
$souscategories = Db::getInstance()->ExecuteS('
SELECT *
FROM table where n = '.$id.'');
Thanks to give some help , idea solve it