<!DOCTYPE html>
<html lang="en">

 <?php include 'head.php';?>
<style>
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
}

h1, h2 {
    text-align: center;
}

.branch-list {
    list-style-type: none;
    padding: 0;
    text-align: center;
}

.branch-list li {
    margin: 10px 0;
}

.branch-list a {
    text-decoration: none;
    color: #333;
    font-weight: bold;
}

.branch-list a:hover {
    color: #4CAF50;
}

/* Add more styling as needed */

table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
  margin: 0 auto;
  border:2;
}

th, td {
  padding: 10px;
  text-align: left;
}

th {
  background-color: #04AA6D;
  color: white;
}
label, input {
  width: 200px;
}
</style>
<body>

  <!-- ======= Header ======= -->
  
 <?php include 'menubar.php';?>

 <?php include 'sidebar.php';?>


  <main id="main" class="main">

<?php
/* Attempt MySQL server connection. Assuming you are running MySQL
server with default setting (user 'root' with no password) */
$link = mysqli_connect("localhost", "tslibrary_user", "rb!tsl838", "tslibrary_data");
 
// Check connection
if($link === false){
    die("ERROR: Could not connect. " . mysqli_connect_error());
}
$var = $_GET['ID'];

// Attempt select query execution
$sql = "SELECT * FROM student_registration where student_id='$var'";
if($result = mysqli_query($link, $sql)){
    if(mysqli_num_rows($result) > 0){

        while($row = mysqli_fetch_array($result)){
  
               $studentid= $row['student_id'] ;
			    $name=$row['name'];
				 $std_mobile= $row['mobile'].','.$row['mobile2'] ;
               $feesamount=$row['fees_amount'] ;
			   $batch=$row['batch_time'] ;
			   $table_no=$row['table_no'] ;
               $dropoutstatus=$row['drop_out'] ;
        }
       
        // Free result set
        mysqli_free_result($result);
    } else{
      
	
    }
} else{
    echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
 
// Close connection
mysqli_close($link);
?>

<br><br>
  
<h2>UPDATE DROP OUT STUDENTS </h2>
<hr>
    <form action="dropout.php" method="POST">
        <label for="student_id" width='100'>Student ID:</label>
        <input type="text"  width='100' id="student_id" name="student_id" value='<?php echo $studentid ?>' readonly ><br>
		
<label for="student_id" width='100'>Name:</label>
        <input type="text"  width='100' id="student_name" name="student_name" value='<?php echo $name ?>'  readonly ><br>
		
		<label for="student_id" width='100'>DROP OUT</label>
        
  <select name="drop" id="drop">
  <option ><?php echo $dropoutstatus ?></option>
 
  <option value="YES">YES</option>
  <option value="NO">NO</option>

</select><BR>
<input type="submit" name="submit" value="UPDATE">
       
    </form>

<?php

$link = mysqli_connect("localhost", "tslibrary_user", "rb!tsl838", "tslibrary_data");

// Check connection
if ($link === false)
{
    die("ERROR: Could not connect. " . mysqli_connect_error());
}

if ($_SERVER["REQUEST_METHOD"] == "POST") 
{
$studentid = mysqli_real_escape_string($link, $_POST['student_id']);
$drop= mysqli_real_escape_string($link, $_POST['drop']);



// Attempt update query execution
$sql = "UPDATE student_registration
 SET 
 drop_out='$drop'
 
WHERE student_id='$studentid'";
if (mysqli_query($link, $sql))
	{
    echo "Records were updated successfully.";
} else 
{
    echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}


}
// Close connection
mysqli_close($link);
?>



<a href="viewregistraion.php">VIEW WEB PAGE</a>



  </main><!-- End #main -->
<br>
   <?php include 'footerr.php';?>

</body>

</html>