<?php 
include('../dbconnect.php');
?>

<?php 
$empteam = $_POST['team'];
if($empteam == 'All'){

    $sql = "SELECT * FROM empinfo JOIN empdetails ON empinfo.empid = empdetails.detailid ";


}else{
    $sql = "SELECT * FROM empinfo JOIN empdetails ON empinfo.empid = empdetails.detailid WHERE team='$empteam'";



}
$sqlres = mysqli_query($conn, $sql);
while($sqlrow = mysqli_fetch_assoc($sqlres))
{
    $output .= '<tr>
    <td>'.$sqlrow['empid'].'</td>
    <td>'.$sqlrow['firstname'].' '.$sqlrow['surname'].'</td>
    </tr>';



}

$data = array(
    'employeeinfo' => $output
 
);

echo json_encode($data);


?>



