<?php
include "../include/config.php";
session_start();
$userlogin=$_SESSION['fullname'];
$school=$_SESSION['school'];
if (isset($_SESSION['email'])){?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
      <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">
    <meta name="theme-color" content="">
      <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://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">

<script src="https://cdn.jsdelivr.net/npm/tinymce/tinymce.min.js"></script>
    <style>
        body {
            background-color: #f4f4f4;
            font-family: 'Arial', sans-serif;
        }
        .container {
            max-width: 450px;
            margin: 50px auto;
            background: #fff;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        }
        .btn-primary {
            background-color: var(--primary);
            border: none;
            border-radius: 8px;
        }
        .btn-primary:hover {
            background-color: #469878;
        }
    
</style>
<body>
<?php include "../include/nav.php";?>
    <br><br> <br>
        
<div class="bnn" style="padding:10px" >
<?php

if (isset($_GET['error'])) {?>
<div class="alert alert-warning" style="text-align:center;">
<p><i class="fa fa-warning">  </i> <?php echo $_GET['error'];?></p>
</div>
<?php
}
?>
    <?php

if (isset($_GET['success'])) {?>
<div class="alert alert-success" style="text-align:center;">
<p><i class="fa fa-check">  </i> <?php echo $_GET['success'];?></p>
</div>
<?php
}
?>    <h2 class="text-center">Send Message</h2>
    <p class="text-center">Select Intake & Program to send a message.</p>

    <form action="send_email.php" method="POST">
        <div class="mb-3">
            <label class="form-label">Select Intake</label>
            <select name="intake" class="form-control" required>
                <option value="">Select Intake</option>
                <?php
                $query = mysqli_query($conn, "SELECT DISTINCT intake FROM students ORDER BY intake DESC");
                while ($row = mysqli_fetch_array($query)) { ?>
                    <option value="<?php echo $row['intake']; ?>"><?php echo $row['intake']; ?></option>
                <?php } ?>
            </select>
        </div>

        <div class="mb-3">
            <label class="form-label">Select Program</label>
            <select name="program" class="form-control" required>
                <option value="">Select Program</option>
                <?php
                $query = mysqli_query($conn, "SELECT DISTINCT program FROM students ORDER BY program ASC");
                while ($row = mysqli_fetch_array($query)) { ?>
                    <option value="<?php echo $row['program']; ?>"><?php echo $row['program']; ?></option>
                <?php } ?>
            </select>
        </div>

        <div class="mb-3">
            <label class="form-label">Message</label>
            <textarea name="message" class="form-control" placeholder="Enter your message" required></textarea>
        </div>

        <input type="submit" name="send" class="btn" value="Send Message" >
    <br><br><br><br>
    </form>
</div>

<script>
</script>

    
</body>
</html>


</div>


</body>
</html>


<?php

}else {

  header("location:../index.php");
}
?>