three dropdwon

_form.php

i does not display the first country select and his contry only state display

this file in all country state and city display plz give me code

<div class="row">

&lt;tr&gt;


&lt;td&gt;


&lt;?php echo &#036;form-&gt;labelEx(&#036;model,'country'); ?&gt;


&lt;/td&gt;


&lt;td&gt;


&lt;?php


    &#036;CountryArray = CHtml::listData(country::model()-&gt;findAll(),'cid','country');


    echo &#036;form-&gt;DropDownList(&#036;model,'cid',&#036;CountryArray,array('prompt'=&gt;'--select--'),


    array(


    'ajax' =&gt; array(


    'onchange' =&gt; 'getState(this.value)',


    'update'=&gt;'#'.CHtml::activeId(&#036;model,'sid'))));


    


?&gt;


&#60;script&gt;function getState(val) 


{


    &#036;.ajax(


    {


        type :'POST', //request type


        url : '&lt;?php echo CController::createUrl('controller/dynamicState')?&gt;',


        success : function(data) 


        {


            &#036;('#sid').html(data);


        }


    };


}

</script>

&lt;/td&gt;


&lt;/tr&gt;


&lt;?php echo &#036;form-&gt;error(&#036;model,'cid'); ?&gt;


&lt;/div&gt; 





&lt;div class=&quot;row&quot;&gt;


&lt;tr&gt;


&lt;td&gt;


&lt;?php echo &#036;form-&gt;labelEx(&#036;model,'state'); ?&gt;


&lt;/td&gt;


&lt;td&gt;


&lt;?php echo &#036;form-&gt;DropDownList(&#036;model,'sid', 


    CHtml::listData(state::model()-&gt;findAll(), 'sid', 'state'),array('prompt'=&gt;'--select--'),


    array(


    'ajax' =&gt; array(


    'onchange' =&gt; 'getCity(this.value)',


    'update'=&gt;'#'.CHtml::activeId(&#036;model,'ctid'))));


?&gt;


&#60;script&gt;function getCity(val) 


{





    &#036;.ajax(


    {


        type :'POST', //request type


        url : '&lt;?php echo CController::createUrl('controller/dynamicCity')?&gt;',


        success : function(data) 


        {


            &#036;('#ctid').html(data);


        }


    };


}

</script>

&lt;?php echo &#036;form-&gt;error(&#036;model,'sid'); ?&gt;


&lt;/td&gt;


&lt;/tr&gt;


&lt;/div&gt;





&lt;div class=&quot;row&quot;&gt;


&lt;tr&gt;


&lt;td&gt;


&lt;?php echo &#036;form-&gt;labelEx(&#036;model,'city'); ?&gt;


&lt;/td&gt;


&lt;td&gt;


&lt;?php echo &#036;form-&gt;DropDownList(&#036;model,'ctid', 


    CHtml::listData(city::model()-&gt;findAll(), 'ctid', 'city'),array('prompt'=&gt;'--Select--') ); ?&gt;


&lt;?php echo &#036;form-&gt;error(&#036;model,'ctid'); ?&gt;


&lt;/td&gt;


&lt;/tr&gt;


&lt;/div&gt;

statecontrollers.php

public function actionDynamicState()

{


    


    while(&#036;row=mysql_fetch_array(&#036;data))


    {


        &#036;cid = &#036;_POST['state']['cid'];


        &#036;data=state::model()-&gt;findAll('cid=:cid',


        array(':cid'=&gt;(int) &#036;_POST['cid']));


        &#036;data=CHtml::listData(&#036;data,'sid','state');


        foreach(&#036;data as &#036;value=&gt;&#036;state)


        {


            echo CHtml::tag('option',


            array('value'=&gt;&#036;value),CHtml::encode(&#036;state),true);


        }


    }


}

Is it still live?

If still alive topic I can help you