Windows NT P3613 10.0 build 20348 (Windows Server 2022) AMD64
C:
/
Inetpub
/
vhosts
/
gyandeepclasses.com
/
pdpandyamcc.com
/
admin
/
C:/Inetpub/vhosts/gyandeepclasses.com/pdpandyamcc.com/admin/staffdetailsaupdate.php
<?php include_once('header.php'); ?> <!-- partial --> <div class="main-panel"> <?php if ($_SERVER['REQUEST_METHOD'] == "POST") { // Collect all form data $staffId = strip_tags( $_POST['id']); $name = strip_tags( $_POST['name']); $degree = strip_tags( $_POST['degree']); $email = strip_tags( $_POST['email']); $contactNo = strip_tags( $_POST['contact_no']); $address = strip_tags( $_POST['address']); $joiningDate = strip_tags( $_POST['joining_date']); $leftDate = strip_tags( $_POST['left_date']); $currentStatus = strip_tags( $_POST['current_status']); $post = strip_tags( $_POST['post']); $stmt = $conn->prepare("UPDATE staff_details SET Name=?, Degree=?, Email=?, ContactNo=?, Address=?, Joining_date=?, Left_date=?, Current_Status=?, Post=? WHERE id=?"); $stmt->bind_param("ssssssssss", $name, $degree, $email, $contactNo, $address, $joiningDate, $leftDate, $currentStatus, $post, $staffId); if ($stmt->execute()) { echo "<script>alert('Staff details updated successfully.'); window.location.href='staffdetailslist.php';</script>"; exit(); } else { echo "<script>alert('Update failed. Please try again.');</script>"; } } // Get the staff ID from the URL $staffId = $_GET['id']; $data = $conn->query("SELECT * FROM staff_details WHERE id=$staffId"); $row = $data->fetch_assoc(); ?> <div class="content-wrapper"> <div class="row"> <div class="col-lg-12 grid-margin stretch-card"> <div class="card"> <div class="card-body"> <h4 class="card-title" style="font-size:30px">Update Staff Details</h4> <div class="table-responsive"> <div class="card"> <div class="content"> <form method="POST"> <br> <div class="col-md-10"> <div class="form-group"> <label>Name</label> <input type="text" class="form-control" name="name" value="<?php echo htmlspecialchars($row['Name']); ?>" placeholder="Name" required> </div> <div class="form-group"> <label>Degree</label> <input type="text" class="form-control" name="degree" value="<?php echo htmlspecialchars($row['Degree']); ?>" placeholder="Degree" required> </div> <div class="form-group"> <label>Email</label> <input type="email" class="form-control" name="email" value="<?php echo htmlspecialchars($row['Email']); ?>" placeholder="Email" required> </div> <div class="form-group"> <label>Contact No</label> <input type="text" class="form-control" name="contact_no" value="<?php echo htmlspecialchars($row['ContactNo']); ?>" placeholder="Contact No" required> </div> <div class="form-group"> <label>Address</label> <input type="text" class="form-control" name="address" value="<?php echo htmlspecialchars($row['Address']); ?>" placeholder="Address" required> </div> <div class="form-group"> <label>Joining Date</label> <input type="date" class="form-control" name="joining_date" value="<?php echo htmlspecialchars($row['Joining_date']); ?>" required> </div> <div class="form-group"> <label>Left Date</label> <input type="date" class="form-control" name="left_date" value="<?php if($row['left_date']!=null) echo htmlspecialchars($row['left_date']); ?>"> </div> <div class="form-group"> <label>Current Status</label> <input type="text" class="form-control" name="current_status" value="<?php echo htmlspecialchars($row['Current_Status']); ?>" placeholder="Current Status" required> </div> <div class="form-group"> <label>Post</label> <input type="text" class="form-control" name="post" value="<?php echo htmlspecialchars($row['Post']); ?>" placeholder="Post" required> </div> <div class="form-group"> <label>Image</label> <img src="<?php if($row['image']!=null) echo htmlspecialchars($row['image']); ?>" alt="Not uploaded"><br> <input type="file" class="form-control" id="image" name="image" placeholder="Post"> </div> <div class="form-group"> <label>Additional Details</label> <textarea class="form-control" id="details" name="details" placeholder="Add Details" rows="3"><?php echo htmlspecialchars($row['details']); ?></textarea> </div> <input type="hidden" name="id" value="<?php echo $row['Id']; ?>"> </div> <div class="clearfix"></div> <div class="card-footer"> <button type="submit" class="btn btn-primary mr-2">Update Staff Details</button> </div> </form> </div> </div> </div> </div> </div> </div> </div> <?php include_once('footer.php'); ?> </div>