I want to show names of the employee in drop down list fetched from database depending on type of team checked by the user (Teams like Hr,PD,PI) are in the form of checkboxes .how can i do this? the code m using is:-
`<li><input type="checkbox" name="box[]" value="Ac&Admin" onClick="dropdown(0)" />Ac&Admin</li>
<li><input type="checkbox" name="box[]" value="HR" onClick="dropdown(2)"/>HR</li>
<li><input type="checkbox" name="box[]" value="pd" onClick="dropdown(3)" />PD</li>
<li><input type="checkbox" name="box[]" value="pi" onClick="dropdown(4)"/>PI</li>`
</tr>
<tr>
<td class=bleu align=left>Name</td>
<td valign="middle" align=left >
<select name=cmbname id="cmbname" width='50%'>
<option value='ALL' selected >ALL</option>
<?php
$objContext = c_Context::BuildContext('attendance1');
$objDB = $objContext->GetDB();
$cond="";
$sql="Select empname from mstEmp ";
if(isset($_POST['box']))
{
$cbox=$_POST['box'];
foreach ($cbox as $key => $value)
{
if($value=='HR')
$sql.="where teamtype= 'HR'";
else if($value=='Gaurd')
$sql.="where teamtype= 'Gaurd'";
else if($value=='Ac&Admin')
$sql.="where teamtype= 'Ac&Admin'";
else if($value=='pd')
$sql.="where teamtype= 'PD'";
else if($value=='Visitor')
$sql.="where teamtype= 'Visitor'";
else if($value=='pi')
$sql.="where teamtype= 'PI'";
else if($value=='pt')
$sql.="where teamtype= 'PT'";
else
$sql.="where teamtype= 'Specialist'";
}
}
$objDB->SetQuery($sql);
$res = $objDB->GetQueryReference();
if(!$res)
exit("Error in SQL : $sql");
if($objDB->GetNumRows($res) == 0)
exit("No employee records\n<BR>");
while($row = mysql_fetch_row($res))
{
print("<option value='{$row[0]}'>{$row[0]}</option>");
}
mysql_free_result($res);
?>
`