I got the error.. Actually i was using JQuery for this
This is code for original user interface .php file as
<?php
session_start();
if(!$_SESSION['sessionusername'])
{
header("location:index.php");
}
else
{
include ('connection2.php');
include('PHP/combo_val.php');
$local_session = $_SESSION['sessionusername'];
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<link rel="stylesheet" media="screen" href="css/master.css">
<link rel="stylesheet" media="screen" href="css/menus.css">
<link href="CSS/pstyle.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="JScript/jquery-1.9.1.js"> </script>
<script type="text/javascript" src="JScript/naddemp.js"></script>
<span id="validate_msg"></span>
<form id="form_naddemp" method="POST" action="newaddemployee.php">
<p>
<label id="lbl_empid">* Employee Id :</label>
<select id="slct_empid">
<option disabled selected>Select Employee Id</option>
<?php fetch_empid() ?>
</select>
<span class="sempid"></span>
</p>
<p>
<label id="lbl_deptname">* Department Name :</label>
<select id="dept_name">
<option disabled selected>Select department name</option>
<?php fetch_dept() ?>
</select>
<span class="sdeptname"></span>
</p>
<p>
<label id="lbl_desgname">* Designation Name :</label>
<select id="desg_name">
<option disabled selected>Select designation name</option>
</select>
<span class="sdesgname"></span>
</p>
<!--<input type="submit" id="save" value="Save" />-->
<button id="submit">Save</button>
<!--<button name="close" id="close">Close</button>-->
<input type="button" id="close" value="Close" onClick="window.location = 'addemployee.php'">
</form>
</body>
</html>
and MY JQuery COde is as---
$(document).ready(function() {
$('#dept_name').bind('change click scroll ',function(e) {
fill_designations();
});
});
function fill_designations(){
$('#dept_name').change(function(e) {
$.post('PHP/combo_new.php', {deptid: $('#dept_name option:selected').val()},
function(info){
$('#desg_name').load(info);
$("#validate_msg").html(info).addClass('validatectrl');
//clear_fields();
});
});
}
and combo_new.php file is as
<?php
include ('../connection2.php');
if((isset($_POST['deptid'])) && $_POST['deptid'] != ""){
echo $lcl_deptid = $_POST['deptid'];
$query = mysql_query("SELECT desg.DesgId temp1, desg.DesgName temp2 FROM table_mstr_designation desg INNER JOIN table_dept_desg deptdesg ON deptdesg.DesgId = desg.DesgId WHERE deptdesg.DeptId = '$lcl_deptid'") or die(mysql_error());
/*$query = mysql_query("SELECT * FROM table_mstr_department where DeptId='$lcl_deptid'");*/
while($val = mysql_fetch_array($query)){
echo '<option value="' . $val['temp2'] . '">' . $val['temp2'] . '</option>';
}
}
?>
and combo.val is as
<?php
function fetch_dept(){
$query = mysql_query("SELECT * FROM table_mstr_department ORDER BY DeptName");
while($val = mysql_fetch_array($query)){
echo '<option value="' . $val['DeptId'] . '">' . $val['DeptName'] . '</option>"';
}
}
function fetch_desg(){
$query = mysql_query("SELECT * FROM table_mstr_designation ORDER BY DesgName");
while($val = mysql_fetch_array($query)){
echo '<option value="' . $val['DesgId'] . '">' . $val['DesgName'] . '</option>"';
}
}
function fetch_empid(){
$query = mysql_query("SELECT * FROM table_emp_reg WHERE STATUS = 'NOT-ACTIVATED';");
while($val = mysql_fetch_array($query)){
echo '<option value="' . $val['EmpId'] . '">' . $val['EmpId'] . '</option>"';
}
}
?>
Now the problem is that my third combo is not loaded and I do not know why??????