<?php 
 include("dbConfig.php");
 
  $lang = $_POST["lang"];
 include("../languege_filee_hr.php");

 $company_id_sel = $_POST["company_id_sel"];
 if($lang=='ar'){$accept="موافقة";}else{$accept="accept";}
 if($lang=='ar'){$after="بعد";}else{$accept="after";}
 if($lang=='ar'){$befor="في البدايه";}else{$befor="at the begning";}
 ?>

  <option value="">حدد المستوى ...</option>
  
 <?php
$sql = "SELECT * FROM hr_advance_level_tbl where company_id='$company_id_sel'";
 $result = $conn->query($sql);
  if ($result->num_rows > 0) {?>
  <option value="at_the_begning"><?php echo $befor ?></option>
      // output data of each row
     <?php  while($row = $result->fetch_assoc()) { 

     $sql_dept = "SELECT * FROM dept_tb where dept_id='".$row["dept_id"]."'";
     $result_dept = $conn->query($sql_dept);
      if ($result_dept->num_rows > 0) {?>
          // output data of each row
         <?php  while($row_dept = $result_dept->fetch_assoc()) { 
if($lang=='ar'){$dept_name=$row_dept["dept_name"];}else{$dept_name=$row_dept["dept_name_en"];}
?>
<option value="<?php echo $row["level"];?>"><?php echo $after." ".$accept." ".$dept_name ;?></option>

        <?php }} ?>
          
     <?php }
  } else {?>
  <option value="at_the_begning"><?php echo $befor ?></option>
    <?php  }?>