<?php
include '../connect.php';
$name=$_POST['Major'];
$sql="SELECT*FROM intern WHERE major='$name'";
$result=mysqli_query($con,$sql);
$count=mysqli_num_rows($result);
?>
<table class="table align-items-center mb-0">
<?php
if($count){
    ?>
  <thead>
                  <tr>
                  <th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Student</th>
                      <th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7 ps-2">University</th>
                      <th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Major</th>
                      <th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Graduation Date</th>
                      <th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Mobile Number</th>
                      <th class="text-secondary opacity-7"></th>
                  </tr>
                  <?php } else{
                    echo "Sorry, No Result found";
                  } ?>
                </thead>
                <tbody>
                <?php
            while ($row = mysqli_fetch_assoc($result)) {
              $id = $row['id'];
              $fullname = $row['fullName'];
              $email = $row['email'];
              $gd_date = $row['graduationDate'];
              $mobileNb = $row['mobileNb'];
              $uni = $row['university'];
              $major = $row['major'];
            ?>
                    <tr>
                      <td>
                        <div class="d-flex px-2 py-1">
                          <div>
                            <img src="../assets/img/team-2.jpg" class="avatar avatar-sm me-3" alt="user1">
                          </div>
                          <div class="d-flex flex-column justify-content-center">
                            <h6 class="mb-0 text-sm"><?php echo $fullname?></h6>
                            <p class="text-xs text-secondary mb-0"><?php echo $email?></p>
                          </div>
                        </div>
                      </td>
                      <td>
                        <p class="text-s font-weight-bold mb-0"><?php echo $uni?></p>
                      </td>
                      <td class="align-middle text-center text-sm">
                      <p class="text-m text-secondary mb-0"><?php echo $major?></p>
                      </td>
                      <td class="align-middle text-center">
                        <span class="text-secondary text-s font-weight-bold"><?php echo $gd_date?></span>
                      </td>
                      <td class="align-middle text-center">
                        <span class="text-secondary text-m font-weight-bold"><?php echo $mobileNb?></span>
                      </td>
                    </tr>
                    <?php
            }
                    ?>
                </tbody>
</table>
