Viewing file: edit_student.php (6.3 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<!DOCTYPE html> <html lang="en">
<?php include 'head.php';?>
<body>
<!-- ======= Header ======= --> <?php include 'menubar.php';?>
<?php include 'sidebar.php';?>
<main id="main" class="main">
<div class="pagetitle"> <h1>Dashboard</h1> <nav> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="index.html">Home</a></li> <li class="breadcrumb-item active">Dashboard</li> </ol> </nav> </div><!-- End Page Title --> <section class="section dashboard"> <?php include 'connect.php';
if (!isset($_GET['ID'])) { die("ID not provided."); }
$id = $_GET['ID']; $query = "SELECT * FROM admission WHERE ID = ?"; $stmt = $conn->prepare($query); $stmt->bind_param("i", $id); $stmt->execute(); $result = $stmt->get_result(); $row = $result->fetch_assoc();
if (!$row) { die("Student not found."); } ?>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Edit Student Record</title> <style> body { font-family: Arial, sans-serif; background: #f4f7f9; padding: 30px; }
.container { max-width: 800px; margin: auto; background: #fff; padding: 25px 40px; border-radius: 10px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
h2 { text-align: center; color: #004080; margin-bottom: 25px; }
form label { display: block; margin-top: 15px; font-weight: bold; color: #333; }
input[type="text"], input[type="date"], input[type="file"] { width: 100%; padding: 10px; margin-top: 6px; border: 1px solid #ccc; border-radius: 5px; font-size: 15px; } select { width: 100%; padding: 10px; margin-top: 6px; border: 1px solid #ccc; border-radius: 5px; font-size: 15px; }
input[type="submit"] { margin-top: 25px; background-color: #004080; color: white; padding: 12px 25px; font-size: 16px; border: none; border-radius: 6px; cursor: pointer; width: 100%; }
input[type="submit"]:hover { background-color: #0055a5; }
.photo-section { margin-top: 20px; }
.photo-section img { max-width: 120px; height: auto; border-radius: 5px; border: 1px solid #ccc; }
@media (max-width: 600px) { .container { padding: 20px; } } </style> </head> <body>
<div class="container"> <h2>Edit Student Record</h2>
<form action="update_student.php" method="post" enctype="multipart/form-data"> <input type="hidden" name="ID" value="<?php echo $row['ID']; ?>">
<label>Name: <input type="text" name="name" value="<?php echo htmlspecialchars($row['name']); ?>"> </label>
<label>Enrollment: <input type="text" name="enrollment" value="<?php echo htmlspecialchars($row['enrollment']); ?>"> </label>
<label>Father Name: <input type="text" name="fatherName" value="<?php echo htmlspecialchars($row['fatherName']); ?>"> </label>
<label>Mother Name: <input type="text" name="motherName" value="<?php echo htmlspecialchars($row['motherName']); ?>"> </label> <label>Courses:<br> <select name="course" required> <option value="">-- Select Course --</option> <?php // Fetch courses from the database $courseQuery = "SELECT course_name FROM courses ORDER BY course_name ASC"; $courseResult = $conn->query($courseQuery);
if ($courseResult && $courseResult->num_rows > 0) { while ($courseRow = $courseResult->fetch_assoc()) { $selected = ($courseRow['course_name'] === $row['course']) ? 'selected' : ''; echo "<option value=\"" . htmlspecialchars($courseRow['course_name']) . "\" $selected>" . htmlspecialchars($courseRow['course_name']) . "</option>"; } } else { echo "<option value=\"\">No courses found</option>"; } ?> </select> </label>
<label>DOB: <input type="date" name="dob" value="<?php echo $row['dob']; ?>"> </label>
<label>Address: <input type="text" name="address" value="<?php echo htmlspecialchars($row['address']); ?>"> </label>
<label>Mobile: <input type="text" name="mobile" value="<?php echo $row['mobile']; ?>"> </label>
<label>Secondary Mobile: <input type="text" name="mobile2" value="<?php echo $row['mobile2']; ?>"> </label>
<label>Aadhar: <input type="text" name="aadhar" value="<?php echo $row['aadhar']; ?>"> </label>
<label>Reg Date: <input type="date" name="reg_date" value="<?php echo $row['reg_date']; ?>"> </label>
<label>Reg Month: <input type="text" name="reg_month" value="<?php echo $row['reg_month']; ?>"> </label>
<label>Reg Year: <input type="text" name="reg_year" value="<?php echo $row['reg_year']; ?>"> </label>
<label>Fees Amount: <input type="text" name="fees_amount" value="<?php echo $row['fees_amount']; ?>"> </label>
<label>Fees Deposit Date: <input type="date" name="fees_deposit_date" value="<?php echo $row['fees_deposit_date']; ?>"> </label>
<label>Fees Mode: <input type="text" name="fees_mode" value="<?php echo $row['fees_mode']; ?>"> </label>
<div class="photo-section"> <label>Current Photo:</label><br> <img src="https://itce.co.in/data/files/<?php echo $row['photo']; ?>" alt="Student Photo"><br><br>
<label>Upload New Photo: <input type="file" name="photo"> </label> </div>
<input type="submit" value="Update Student"> </form> </div>
</body> </html>
</section>
</main><!-- End #main -->
<?php include 'footer.php';?>
</body>
</html>
|