The first dropdown box will be populated when the page loads based on values from a database. The second dropdown box should display a set of values based on the selection from the first dropdown box. I know there have been similar questions asked on here before, but I haven't found a solution that matches my scenario.
UI code:
<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>
<?php foreach ($tam as $row){?>
<option value="<?php echo $row['mod_id']; ?>" ><?php echo $row['mod_name'];?></option>
<?php } ?>
</select></td>
</tr>
<script type="text/javascript">
function get_module(){
var projid = document.getElementById('taProj').value;
alert(projid);
}
</script>
mycontroller.php
public function sample(){
echo $_GET['projid'];
}
its working properly.. My need is...
How to call mycontroller.php file function sample() and how to pass the javascript value to the php function parameter.
I new in the script and jquery. please any suggest me... thanks
Kumar