<!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>
	<style>
	body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
}

h1 {
    text-align: center;
}

form {
    max-width: 500px;
    margin: 0 auto;
}

label {
    display: block;
    margin-top: 10px;
}

input[type="text"],
input[type="date"],
input[type="tel"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

input[type="submit"] {
    background-color: #4CAF50;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    float: right;
}

input[type="submit"]:hover {
    background-color: #45a049;
}
</style>
<body>

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

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


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

<!DOCTYPE html>
<html>
<head>
    <title>Student Search</title>
</head>
<body>

<h2>Search Student by ID</h2>
<form name="Form1" method="get" action="update_registraion.php" enctype="text/plain" id="Form1" onsubmit="return ValidateForm1(this)">
<table style="width: 100%">
	<tr>
		<td style="width: 274px; height: 35px">Enter Registration No:</td>
		<td style="height: 35px">
		<form method="post">
			<input name="q" id='q' style="width: 250px" type="text"></form>
		</td>
	</tr>
	<tr>
		<td style="width: 274px">&nbsp;</td>
		<td>
		
			<button name="Submit" type="submit" id="Button1" name="" value="Submit" style="width: 102px">Submit</button>
	
		</td>
	</tr>
</table>
</form>

<?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['q'];
$serial=1;
// 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)){
  
            $student_id=$row['student_id'];
            $name=$row['name'];
            $father=$row['father'];
            $mother=$row['mother'];
            $dob=$row['dob'];
            $address=$row['address'];
            $mobile1=$row['mobile'];
			$mobile2=$row['mobile2'];
            $aadhar=$row['aadhar'];
           
           
      
            echo "</tr>";
			$serial=$serial+1;
        }
       echo "</table>";
        // Free result set
        mysqli_free_result($result);
    } else{
        echo "Not Available any student ID";
	exit;	
    }
} else{
    echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
 
// Close connection
mysqli_close($link);
?>



      <h1>Student Registration Form</h1>
    <form action="update_submit.php" method="POST">
	<label for="name">Registration No</label>
        <input type="text" id="regno" name="regno" value='<?php echo $student_id ?>' readonly required><br>

        <label for="name">Name:</label>
        <input type="text" id="name" name="name" value='<?php echo  $name ?>' readonly required><br>

        <label for="father">Father's Name:</label>
        <input type="text" id="father" name="father" value='<?php echo $father ?>' required><br>

        <label for="mother">Mother's Name:</label>
        <input type="text" id="mother" name="mother" value='<?php echo $mother ?>' required><br>

        <label for="dob">Date of Birth:</label>
        <input type="text" id="dob" name="dob" value='<?php echo  $dob ?>' required><br>

        <label for="address">Address:</label>
        <input type="text" name="address" value='<?php echo   $address ?>' required><br>

        <label for="mobile">Mobile:</label>
        <input type="text" id="mobile" name="mobile"  value='<?php echo  $mobile1 ?>' required><br>

        <label for="mobile2">Secondary Mobile:</label>
        <input type="text" id="mobile2" name="mobile2" value='<?php echo $mobile2 ?>' ><br>

        <label for="aadhar">Aadhar Number:</label>
        <input type="text" id="aadhar" name="aadhar" value='<?php echo $aadhar ?>' required><br>

       

      
<?php
// Step 1: Connect to the database
$conn = new mysqli("localhost", "tslibrary_user", "rb!tsl838", "tslibrary_data");

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// Step 2: Retrieve data from the database
$sql = "SELECT batch_time FROM batch";
$result = $conn->query($sql);

// Step 3: Create the dropdown list
if ($result->num_rows > 0) {
    echo '<select name="batch_time" id="batch_time">';
    while ($row = $result->fetch_assoc()) {
        echo '<option value="' . $row["batch_time"] . '">' . $row["batch_time"] . '</option>';
    }
    echo '</select>';
} else {
    echo "No data available.";
}

// Close the database connection
$conn->close();
?>


        <input type="submit" value="Update">
    </form>
   



  </main><!-- End #main -->

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

</body>

</html>