how to display table values to a listbox based on another listbox selected value

Hi everyone

I have two activeListBoxes named as chapter and sections.

when i choose a chapter from chapter listbox it must display its sections( from table based one chapter)to listbox sections

How, please give idea.

Something like this



<?php echo CHtml::activeDropDownList($chapter,'chapterId',


        Chtml::listData($sections, 'sectionId', 'sectionTitle'),


        array('size'=>6,'class'=>'dropdown','ajax' => array(


        'type'=>'POST',


        'url'=>array('controller/action'),


        'update'=>'#sections',


        ),


        )); 


<div sections>





</div>


The controller/action should return something like this:



 <?php echo CHtml::activeDropDownList($sections,'sectionId',


          Chtml::listData($sections, 'sectionId', 'sectiontitle'),); ?>


Hi, I need activeListBoxes not activeDropDownlist

It's almost the same.Just use this approach with activeListBox

But i want to modify the selected listbox item by using a text box and i wish to traverse like below

section1

…parentsection

…subsection

by using submitbuttons

but when i click save button then only listbox contents saved to table.

my first listbox has no right,left moving and both listboxes have up,down moving.

So I used Session array variable to store chapter listbox and I did modify,up and down moving and finally on clicking save button session array saved or modified to table,

now i need like following

on click a dropdownlist

CHtml::activeDropDownList($form,'drop',$data,array('name'=>'drop','submit'=>array('')));

on controller action i got its selected value on clicking it by

if(isset($_POST['drop']))

{

echo $_POST['drop'];

$form->drop= $_POST['drop'];

}

i did above work  same for activeListBox  since i want to display table values in sections listbox based on chapter listbox clicking and to store it in session .

But above code didn't work well,How to change it

Since at clicking chapter activeListBox, its related values on a table must be stored

to a Session array varible then it will be displayed to section listbox and then modification of listbox again stored to Session at finally on click save button session stored to or modified to table