On change of the dropdown list, A php function should called.
Inside the PHP function I will do some calculation. Later I need to set the value of a text box or else
You can't call a php function from js or html, but you can do that by ajax call to a php function where you can perform your calculation and then return the result value to js, so then you can do by js to html...
Update:
<select name="employee" id="employee" onchange="getIPL(this.value);">
<option value="">Select Employee</option>
</select>
function getIPL(id)
{
$.ajax({
type: "GET",
url: "EmpLeave.php",
data: "emp_Id =" + id,
success: function(result){
$("#somewhere").html(result);
}
});
};
// Empleave.php file....
if(isset($_GET['emp_Id'])){
GetTotalPL($_GET['emp_Id']);
}
function GetTotalPL($id){
// do your calculation...
}
Insert your function in a php file to excute , then you could call php file with ajax ( i suggest u use jQuery )
///////////////////////// foo.php
<?php
Function foo (){
// Your process
}
foo();
?>
///////////////////// text.html
<select name="test" id="test" >
<option>.....</option>
.
.
.
.
</select>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'></script>
<script type="text/javascript">
$('#test').change(function(){
$.ajax({
type: "GET",
url: "foo.php",
success:function(){
// Your function after execute foo.php
}
})
})
</script>