how to do second dropdown based on selection of first dropdown using script and PHP/MySQL

Permalink 1 user found helpful
my single page code:

<form method="post" action="<?php echo $this->action('save_task') ?>">
            <table class="row-fluid">
               <tr>
                  <td><label for="taProj"><?php echo t('Project')?>:</label></td>
                  <td><select name="taProj" id="taProj" onchange= "get_module()">
                     <option value="" >-------------------------</option>
                     <?php   foreach ($tap as $row){?>               
                     <option value="<?php echo $row['proj_id']; ?>" ><?php echo $row['proj_name'];?></option>
                     <?php } ?>
                  </select></td>
               </tr>
               <tr>                  
                  <td><label for="taModule"><?php echo t('Module Name')?>:</label></td>
                  <td><select name="taModule" id="taModule" >
                     <option value="" >-------------------------</option>


controller code:
Class TaskAllocationAddTaskController extends Controller {
   public function on_start() {
      $html = Loader::helper('html');
      $this->addHeaderItem($html->css('jquery.ui.css'));
      $this->addHeaderItem($html->css('ccm.dialog.css'));
      $this->addHeaderItem($html->javascript('jquery.ui.js'));
      $this->addHeaderItem($html->javascript('ccm.dialog.js'));
      Loader::model('projectinfo');
      Loader::model('moduleinfo');
      Loader::model('employeeinfo');
      //project
      $tap = projectinfo::get_proj();   
      $this->set('tap', $tap);      
      //module
      $tam = moduleinfo::get_module();



Now i want to pass the projid value from single then load the option in the module 'taModule' dropdown

View Replies:
shankumars replied on at Permalink Reply
Hi I got some idea from google by using ajax. but i dont know its right or wrong

$.ajax({
url: '<?php echo $this->action('sample'); ?>',
data: {variable: value}
}});


any one suggest the right way....
ronyDdeveloper replied on at Permalink Reply
ronyDdeveloper
shankumars replied on at Permalink Reply
This is already john suggest to me... but i cant understand the add-on code... that why i ask again to you... will you suggest me any other easy way or link to understand to my knowledge