<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
session_start();
include "../include/config.php";
$userlogin=$_SESSION['studentid'];
$studentid=$_SESSION['studentid'];

$intake=$_SESSION['intake'];
$image=$_SESSION['image'];
if (isset($_SESSION['studentid'])){?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Dashboard</title>
    <link rel="stylesheet" href="../../boostrap/1.css">
    <link rel="stylesheet" href="../../boostrap/2.css">
      <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300&family=Source+Sans+Pro:wght@300&display=swap" rel="stylesheet">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
   <link rel="icon" href="favicon.png" type="image/png">
   <!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

<!-- Bootstrap JS -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>

    <meta name="theme-color" content="var(--primary)">
      <script src='https://kit.fontawesome.com/a076d05399.js' crossorigin='anonymous'></script>
      <script src='https://kit.fontawesome.com/a076d05399.js' crossorigin='anonymous'></script>
      <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
      <script src='https://kit.fontawesome.com/a076d05399.js' crossorigin='anonymous'></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-Fy6S3B9q64WdZWQUiU+q4/2Lc9npb8tCaSX9FK7E8HnRr0Jz8D6OP9dO5Vg3Q9ct" crossorigin="anonymous"></script><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Signika+Negative:wght@300..700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="res/bootstrap@5.2.0.min.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Rowdies:wght@300;400;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.3/font/bootstrap-icons.css" rel="stylesheet">
</head>
<style>
    body{
        padding: 0px;
        margin:0px;
        
  font-size:14px;
  width:100%;
  background:;
    }
   /* Overlay */
    .overlay {
      position: fixed;
      top: 0; left: 0;
      width: 100%; height: 100%;
      background: rgba(0,0,0,0.4);
      z-index: 1040;
      display: none;
    }
    .overlay.active { display: block; }

    /* Student Header */
    .student-header {
      background: white;
      margin: 15px auto;
      padding: 15px;
      border-radius: 5px;
      max-width: 1000px;
      box-shadow: 0px 3px 8px rgba(0,0,0,0.1);
    }
    .student-header img {
      width: 90px;
      height: 90px;
      border-radius: 50%;
      object-fit: cover;
      border: 3px solid var(--primary);
    }
    .student-header i{
      color:var(--primary);
    }

    /* Payment Progress */
    .payment-progress {
      background: #f9f9f9;
      padding: 15px;
      border-radius: 12px;
      text-align: center;
      box-shadow: 0px 2px 6px rgba(0,0,0,0.05);
    }

    /* Cards */
    .card-custom {
      background: white;
      border-radius: 16px;
      padding: 20px;
      text-align: center;
      box-shadow: 0px 3px 8px rgba(0,0,0,0.1);
      transition: 0.3s;
    }
    a{
        text-decoration:none;
        color:black;
    }
    a:hover{
        text-decoration:none;
         color:black;
    }
    .card-custom:hover {
      transform: translateY(-4px);
      box-shadow: 0px 6px 14px rgba(0,0,0,0.15);
    }
    .icon-box {
      width: 55px;
      height: 55px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 24px;
      margin: 0 auto 10px;
      background: #f0f0f0;
      color: var(--primary);
    }

    /* Updates */
    .section-title {
      font-weight: 600;
      margin: 20px 0 12px;
      font-size: 18px;
      color: #333;
    }
a{
  text-decoration:none;
}
a:hover{
  text-decoration:none;
}
 .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            width: 100%;
            background: white;
            display: flex;
            justify-content: space-around;
            align-items: center;
            box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
            z-index: 1000;
            padding: 10px 0;
            display: none;
        }
        
        .bottom-nav-link {
            display: flex;
            flex-direction: column;
            align-items: center;
            text-decoration: none;
            color: #777;
            font-size: 14px;
            transition: var(--transition);
        }
        
        .bottom-nav-link.active, .bottom-nav-link:hover {
            color: var(--primary);
        }
        
        .bottom-nav-icon {
            font-size: 18px;
            margin-bottom: 3px;
            color:var(--primary);
        }
        
    .update-list .list-group-item {
      border: none;
      border-radius: 12px;
      margin-bottom: 12px;
      box-shadow: 0px 2px 6px rgba(0,0,0,0.05);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .update-list .btn-sm {
      font-size: 12px;
      padding: 4px 8px;
    }
   .content{
       margin-left:200px;
      
   }
   a{
       text-decoration:none;
   }
  
</style>
<body>

  <?php include "../include/nav.php";?>

  
      
<div class="content" style=" padding:px;">
    
      <?php include "header.php";?> 

<?php
$query = mysqli_query($conn, "SELECT SUM(amount) as paid FROM payments  WHERE studentid='$userlogin' and status='Paid'");

if (mysqli_num_rows($query) > 0) {
    while ($row = mysqli_fetch_array($query)) {
      $total = $row['paid'];
       if($total==0){
        $total = 0;
       }else{
        $total = $row['paid'];
       }
 
      
        
       
        
    }
} 

$query = mysqli_query($conn, "SELECT SUM(amount) as unpaid FROM balances  WHERE intake='$intake'");


    while ($row = mysqli_fetch_array($query)) {
      $unpaid = $row['unpaid'];
   

        $balance=$unpaid-$total;
         if ($total > 0) {
    $per = ($total / $total+$unpaid) * 100;
} else {
    $per = 0; // or handle differently
}
    
      $_SESSION['balance']=$balance;
           
        
    }




  ?>
 



    
  <br>

       
       
          
       <div class="overlay" id="overlay"></div>
       
       
   
    

 
  <!-- Dashboard Cards -->
  <div class="container mt-3">
 
      
       
<?php
// ============================================
// 1. FETCH STUDENT COURSE RESULTS
// ============================================

// Ensure student ID is set
if (!isset($userlogin) || empty($userlogin)) {
    $studentid = "UNKNOWN";
} else {
    $studentid = $userlogin;
}

// Initialize arrays
$stats = [
    'total_courses' => 0,
    'completed_courses' => 0,
    'in_progress_courses' => 0,
    'courses' => []
];

// Query to get all courses for this student
$courses_query = "SELECT `id`, `studentid`, `course`, `term`, `year`, `intake`, `ca`, `ca1`, `ca2`, `exam`, `email` 
                  FROM `results` 
                  WHERE studentid='" . mysqli_real_escape_string($conn, $studentid) . "' 
                  ORDER BY `year` DESC, `term` DESC";

$courses_result = mysqli_query($conn, $courses_query);

if ($courses_result && mysqli_num_rows($courses_result) > 0) {
    $total_courses = 0;
    $completed_courses = 0;
    $in_progress_courses = 0;
    
    while($course_row = mysqli_fetch_assoc($courses_result)) {
        $total_courses++;
        
        // Store course details
        $stats['courses'][] = $course_row;
        
        // Check if course is completed (has exam marks)
        if (!empty($course_row['exam']) && is_numeric($course_row['exam'])) {
            $completed_courses++;
        }
        // Check if course is in progress (has CA marks but no exam)
        else if ((!empty($course_row['ca']) && is_numeric($course_row['ca'])) || 
                 (!empty($course_row['ca1']) && is_numeric($course_row['ca1'])) || 
                 (!empty($course_row['ca2']) && is_numeric($course_row['ca2']))) {
            $in_progress_courses++;
        }
    }
    
    $stats['total_courses'] = $total_courses;
    $stats['completed_courses'] = $completed_courses;
    $stats['in_progress_courses'] = $in_progress_courses;
}

// Calculate not started courses
$not_started_courses = $stats['total_courses'] - $stats['completed_courses'] - $stats['in_progress_courses'];

// ============================================
// 2. FETCH LATEST NEWS (LIMIT 5)
// ============================================
$news_data = [];
$has_news = false;

// Check if news table exists and fetch latest 5 news items
$news_query = "SELECT `id`, `image`, `title`, `message`, `date` FROM `news` ORDER BY `date` DESC LIMIT 5";
$news_result = mysqli_query($conn, $news_query);

if ($news_result && mysqli_num_rows($news_result) > 0) {
    $has_news = true;
    while($news_row = mysqli_fetch_assoc($news_result)) {
        // Format the date
        $news_row['formatted_date'] = date('M d, Y', strtotime($news_row['date']));
        
        // Truncate message for display
        $news_row['truncated_message'] = strlen($news_row['message']) > 100 
            ? substr($news_row['message'], 0, 100) . '...' 
            : $news_row['message'];
            
        $news_data[] = $news_row;
    }
}
?>

<!-- ============================================ -->
<!-- HTML DISPLAY WITH FLEX CARDS -->
<!-- ============================================ -->
<div style="display: flex; flex-wrap: wrap; gap: 8px; padding: 0; height: 100%; align-items: stretch; margin-top: 15px">
<!-- Latest version -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<!-- Main Container for Dashboard -->
<div style="flex: 1; min-width: 300px; display: flex; flex-direction: column; gap: 8px; height: 100%;">

  <!-- News Section (Latest 5) - REPLACES STATS CARDS -->
  <?php if($has_news): ?>
  <div style="background: white; padding: 15px; border-radius: 10px; box-shadow: 0 3px 12px rgba(0,0,0,0.08); flex-grow: 1; display: flex; flex-direction: column; height: 100%;">
    <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;">
      <h2 style="margin: 0; color: #333; font-size: 20px; display: flex; align-items: center; gap: 8px;">
        <i class="bi bi-newspaper" style="color: #6a11cb;"></i>
        Latest Announcements
      </h2>
      <div style="background: #f5f5f5; padding: 6px 12px; border-radius: 20px; font-size: 13px; color: #666;">
        <i class="bi bi-info-circle"></i> Showing latest 5
      </div>
    </div>
    
    <!-- News List -->
    <div style="max-height: 280px; overflow-y: auto; flex-grow: 1;">
      <?php foreach($news_data as $index => $news): ?>
      <div style="padding: 12px; border-bottom: 1px solid #e9ecef; <?php echo $index === 0 ? 'border-left: 4px solid #6a11cb;' : ''; ?> transition: background 0.2s; cursor: pointer;" 
           onclick="window.location.href='news-details.php?id=<?php echo $news['id']; ?>'"
           onmouseover="this.style.background='#f8f9fa'" 
           onmouseout="this.style.background='white'">
        
        <div style="display: flex; gap: 12px; align-items: flex-start;">
          <?php if(!empty($news['image'])): ?>
          <div style="flex-shrink: 0;">
            <img src="../img/<?php echo htmlspecialchars($news['image']); ?>" 
                 alt="News Image" 
                 style="width: 70px; height: 70px; object-fit: cover; border-radius: 6px;">
          </div>
          <?php endif; ?>
          
          <div style="flex-grow: 1;">
            <div style="display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px;">
              <h4 style="margin: 0; font-size: 15px; color: #333; font-weight: 600;">
                <?php echo htmlspecialchars($news['title']); ?>
              </h4>
              <?php if($index === 0): ?>
              <div style="flex-shrink: 0; background: #6a11cb; color: white; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600;">
                <i class="bi bi-star-fill"></i> NEW
              </div>
              <?php endif; ?>
            </div>
            
            <p style="margin: 0 0 6px 0; font-size: 13px; color: #666; line-height: 1.4;">
              <?php echo htmlspecialchars($news['truncated_message']); ?>
            </p>
            
            <div style="display: flex; justify-content: space-between; align-items: center;">
              <div style="font-size: 11px; color: #888; display: flex; align-items: center; gap: 4px;">
                <i class="bi bi-calendar-event"></i> <?php echo $news['formatted_date']; ?>
              </div>
              <div style="font-size: 11px; color: #1976d2; font-weight: 500;">
                Read more <i class="bi bi-arrow-right"></i>
              </div>
            </div>
          </div>
        </div>
        
      </div>
      <?php endforeach; ?>
    </div>
    
    <!-- View All Button -->
    <div style="margin-top: 15px; text-align: center;">
      <a href="news.php" style="display: inline-block; background: #f8f9fa; color: #1976d2; padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 500; text-decoration: none; border: 1px solid #e9ecef; transition: all 0.2s;">
        <i class="bi bi-list"></i> View All News Articles
      </a>
    </div>
  </div>
  <?php else: ?>
  <!-- No news available -->
  <div style="background: white; padding: 20px; border-radius: 10px; box-shadow: 0 3px 12px rgba(0,0,0,0.08); flex-grow: 1; display: flex; flex-direction: column; height: 100%; justify-content: center; align-items: center; text-align: center;">
    <div style="color: #ddd; font-size: 48px; margin-bottom: 12px;">
      <i class="bi bi-newspaper"></i>
    </div>
    <h2 style="margin: 0; color: #666; font-size: 16px; margin-bottom: 8px;">No Announcements Yet</h2>
    <p style="margin: 0; font-size: 13px; color: #999; max-width: 280px;">Check back later for important news and announcements.</p>
  </div>
  <?php endif; ?>
</div>

<!-- Right Sidebar - Course Details -->
<div style="flex: 1; min-width: 300px; max-width: 500px; display: flex; flex-direction: column; gap: 15px; height: 100%;">

  <!-- Course Details Card -->
  <?php if($stats['total_courses'] > 0): ?>
  <div style="background: white; padding: 15px; border-radius: 10px; box-shadow: 0 3px 12px rgba(0,0,0,0.08); flex-grow: 1; display: flex; flex-direction: column; height: 100%;">
    <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;">
      <h3 style="margin: 0; color: #333; font-size: 16px;">Course Details</h3>
      <span style="background: #1976d2; color: white; padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: bold;">
        <?php echo $stats['total_courses']; ?> courses
      </span>
    </div>
    
    <div style="max-height: 380px; overflow-y: auto; flex-grow: 1;">
      <table style="width: 100%; border-collapse: collapse; font-size: 12px;">
        <thead>
          <tr style="background: #f8f9fa; position: sticky; top: 0;">
            <th style="padding: 10px; text-align: left; border-bottom: 2px solid #e9ecef; font-weight: 600; color: #495057;">Course</th>
            <th style="padding: 10px; text-align: left; border-bottom: 2px solid #e9ecef; font-weight: 600; color: #495057;">Year</th>
            <th style="padding: 10px; text-align: center; border-bottom: 2px solid #e9ecef; font-weight: 600; color: #495057;">CA</th>
            <th style="padding: 10px; text-align: center; border-bottom: 2px solid #e9ecef; font-weight: 600; color: #495057;">Status</th>
          </tr>
        </thead>
        <tbody>
          <?php foreach($stats['courses'] as $course): 
            // Calculate CA average
            $ca_scores = [];
            if (!empty($course['ca']) && is_numeric($course['ca'])) $ca_scores[] = $course['ca'];
            if (!empty($course['ca1']) && is_numeric($course['ca1'])) $ca_scores[] = $course['ca1'];
            if (!empty($course['ca2']) && is_numeric($course['ca2'])) $ca_scores[] = $course['ca2'];
            $ca_avg = !empty($ca_scores) ? round(array_sum($ca_scores), 1) : 0;
            
            // Determine status
            if (!empty($course['exam']) && is_numeric($course['exam'])) {
                $status = "Completed";
                $status_bg = "#e8f5e9";
                $status_color = "#2e7d32";
                $status_badge = "✅";
            } else if (!empty($ca_scores)) {
                $status = "In Progress";
                $status_bg = "#fff3e0";
                $status_color = "#ef6c00";
                $status_badge = "⏳";
            } else {
                $status = "Not Started";
                $status_bg = "#f5f5f5";
                $status_color = "#616161";
                $status_badge = "📝";
            }
          ?>
          <tr style="border-bottom: 1px solid #e9ecef;">
            <td style="padding: 10px; color: #333; font-weight: 500;"><?php echo htmlspecialchars($course['course']); ?></td>
            <td style="padding: 10px; color: #666;">Semester <?php echo $course['term']; ?> - <?php echo $course['year']; ?></td>
            <td style="padding: 10px; text-align: center;">
              <span style="display: inline-block; background: #e3f2fd; color: #1976d2; padding: 3px 8px; border-radius: 12px; font-weight: bold; min-width: 35px;">
                <?php echo $ca_avg; ?>
              </span>
            </td>
         
            <td style="padding: 10px; text-align: center;">
              <span style="display: inline-flex; align-items: center; gap: 4px; background: <?php echo $status_bg; ?>; color: <?php echo $status_color; ?>; padding: 5px 10px; border-radius: 12px; font-size: 11px; font-weight: 600;">
                <?php echo $status_badge; ?> <?php echo $status; ?>
              </span>
            </td>
          </tr>
          <?php endforeach; ?>
        </tbody>
      </table>
    </div>
  </div>
  <?php endif; ?>

</div>
<br><br>
</div>

<!-- JavaScript for Chart -->
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
  const ctx = document.getElementById('courseProgressChart');
  
  // Get data from PHP
  const totalCourses = <?php echo $stats['total_courses']; ?>;
  const completedCourses = <?php echo $stats['completed_courses']; ?>;
  const inProgressCourses = <?php echo $stats['in_progress_courses']; ?>;
  const notStartedCourses = <?php echo $not_started_courses; ?>;
  
  // Only create chart if there's data
  if (totalCourses > 0 && ctx) {
    new Chart(ctx, {
      type: 'doughnut',
      data: {
        labels: [
          `Completed (${completedCourses})`, 
          `In Progress (${inProgressCourses})`, 
          `Not Started (${notStartedCourses})`
        ],
        datasets: [{
          data: [completedCourses, inProgressCourses, notStartedCourses],
          backgroundColor: [
            'rgba(56, 142, 60, 0.9)',
            'rgba(245, 124, 0, 0.9)',
            'rgba(117, 117, 117, 0.9)'
          ],
          borderColor: '#fff',
          borderWidth: 3,
          hoverOffset: 20
        }]
      },
      options: {
        responsive: true,
        maintainAspectRatio: false,
        plugins: {
          legend: {
            display: false
          },
          tooltip: {
            callbacks: {
              label: function(context) {
                const label = context.label || '';
                const value = context.raw || 0;
                const percentage = totalCourses > 0 ? Math.round((value / totalCourses) * 100) : 0;
                return `${label.split(' (')[0]}: ${value} course${value !== 1 ? 's' : ''} (${percentage}%)`;
              }
            }
          }
        },
        cutout: '75%'
      }
    });
  }
});
</script>
           
   <div class="modal fade" style="color:gray;"  id="statementone" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLongTitle">Results Statenent </h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
         <form style="background:white; border:none;padding:10px; margin-top:0px; margin-bottom:5px; border-radius:4px;" class=" bg" action="get_results.php" method="post">

  
 <div class="row">
 

<div class="col-6"  style="background:; color:; margin-top:10px"> 
<span style="margin-bottom:-5px">Year <span style="color:red;">*</span> </span>
<select style="margin-top:-5px;color: #7c828c;"  name="year" id="" class="form-control">
 <option value="1">--Year--</option>
  <?php
  $query=mysqli_query($conn,"select *from year order by id desc");
  while($row=mysqli_fetch_array($query)){?>
  
 

<option value="<?php echo $row['year'];?>"><?php echo $row['year'];?></option>
<?php
  }
?>
</select> 
 </div>

<div hidden class="col-6" style="background:; color:; margin-top:10px"> 
<span style="margin-bottom:-5px">Studentid <span style="color:red;">*</span> </span>
<input type="text" value="<?=$_SESSION['studentid'];?>" name="studentid">

</div>


<div class="col-6"  style="background:; color:; margin-top:10px"> 
<span style="margin-bottom:-5px">Semester<span style="color:red;">*</span> </span>
<select   style="margin-top:-5px;color: #7c828c;" name="term" id="" class="form-control">
  <option value="">--Semester--</option>
<option value="1">1</option>
<option value="2">2</option>

</select> 
</div>






 <div class="col-6" style="background:; color:; margin-top:10px">
<input style="border:none;background:var(--hover);padding:10px; color:;" type="submit" name="generate_pdf" value="Download" class="btn "> 
</div>
  
</div>
 
 </form>
      </div>

    </div>
  </div>
</div>


<!-- Modal -->
<div class="modal fade" id="exampleModal33" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel"> </h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
          <center>
        <i class="fa fa-warning" style="color:red; font-size:55px"></i>
          </center>
        <p class="text-danger" style="" ><strong>Unable to download results. Fees paid are insufficient. Please complete required Percentage.
      
         </strong></p>
       
      </div>
    
    </div>
  </div>
</div>

</div>
</div>

     
</body>
</html>
<?php
}else {
  header("location:../index.php");
}

?>


