Jump to content

Two combobox Database


Recommended Posts

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>

in Controller.php

public function initContent()
   $categories = Db::getInstance()->ExecuteS('
   //my sql 

The seconde combobx:


When the customer choose the category, retrieve the id of this class and run the  seconde  query

$souscategories = Db::getInstance()->ExecuteS('
FROM table where n = '.$id.'

Thanks to give some help , idea solve it

Edited by NeedZoom (see edit history)
Link to comment
Share on other sites

Now the second combobox work but i should clik the botton 

in my file TPL i use :

{if $smarty.post.id}selected = "selected"{/if}> 

in the fil  controller.php:

$souscategories = Db::getInstance()->ExecuteS(
FROM table
where champs = '.$id.' and ');

I don't any idea to slove this problem , PLZ help me 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...