<?php
// Start the session
session_start();

?>





<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://getbootstrap.com/docs/5.3/assets/css/docs.css" rel="stylesheet">
    <title>Parent portal</title>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
  <style>
.error {color: #FF0000;}
body {
  background-color: aqua;
}
</style>
  
  </head>
  <body class="p-3 m-0 border-0 bd-example m-0 border-0">


    

   
   <?php //include 'edumenu.php';    ?>
   
    <!-- Example Code -->

   
   
   
   
   
   <center> <h2>  <span class="badge rounded-pill text-bg-primary">Parent's portal   </h2> </center></span>

  
    

    <div class="alert alert-success" role="alert">
    <center> <a href="/parentportal.php" class="alert-link"><?php echo $_SESSION["title"].' '.$_SESSION["surname"]   ?></a></center>
   </div>
   
   <div class="alert alert-primary" role="alert">
   <center> <a href="https://chat.whatsapp.com/EC9wsSURDx397ZRJgKHB6D" class="alert-link">Join whatsapp group</a></center>
   </div>
   
   
   
   <div class="alert alert-primary" role="alert">
   <center> <a href="/parentconcerns.php" class="alert-link">Place concern</a></center>
   </div>
   <div class="alert alert-primary" role="alert">
   <center> <a href="/viewcsc.php" class="alert-link">Concerns stats</a></center>
   </div>
   </div>
   <div class="alert alert-primary" role="alert">
   <center> <a href="/parentportal.php" class="alert-link">My concerns</a></center>
   
   
   
    <?php
$servername = "localhost";
$username = "commemay_sono";
$password = "Masiu@5$5$5$";
$dbname = "commemay_csc";

        // Create connection
        $conn = new mysqli($servername, $username, $password, $dbname);
        // Check connection
        if ($conn->connect_error) {
              die("Connection failed: " . $conn->connect_error);
        }
        
        //variable for counting the total number of teacher
        $number = 1;
        
        
        
        $num =  $_SESSION["num"];
            
        $sql = "SELECT *  FROM parentconcerns WHERE uniquenum = '$num' ";
        $result = $conn->query($sql);

       echo '<table class="table table-light table-striped table-hover">';
       echo '<tbody>';
       
        if ($result->num_rows > 0) {
         // output data of each row
         while($row = $result->fetch_assoc()) {
       
       //setting the variable names
       
        $tconcern = $row["tconcern"];
        $addressedto = $row["addressedto"];
        $regarding = $row["regarding"];
        $school = $row["school"];
        $concern = $row["concern"];
       
      
       
        echo ' <tr  >
     
      <td colspan="3" ><center><button type="button" class="btn btn-primary">
        '.$school.' '.'<span class="badge text-bg-warning"> '.$number.'</span>
            </button></center> </td>
     
      
    </tr>';
       
       echo '<tr>
     
      <td>'.$tconcern.' </td>
      <td>'.$addressedto.'  </td>
       <td>'.$regarding.'  </td>
      
    </tr>';
    
     echo ' <tr>
     
      <td colspan="3">'.$concern.' </td>
      
      
    </tr>';
    
    
       //incrementing number variable
       $number++;
         }
            } 
            
            
        $conn->close();
        
        echo '</tbody>';
        echo '</table>';
        
      
        
?> </div>
  <div class="alert alert-primary" role="alert">
   <center> <a href="/logout.php" class="alert-link">Logout</a></center>
   </div>
  <!-- 
   <div class="alert alert-primary" role="alert">
   <center> <a href="/parentportal.php" class="alert-link">Parent profile</a></center>
   </div>
    -->
    <!-- End Example Code -->
  </body>
</html>