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:
controller code:
Now i want to pass the projid value from single then load the option in the module 'taModule' dropdown
<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>
Viewing 15 lines of 50 lines. View entire code block.
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();
Viewing 15 lines of 20 lines. View entire code block.
Now i want to pass the projid value from single then load the option in the module 'taModule' dropdown
any one suggest the right way....