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/noticeupdate.php
<?php include_once('header.php'); ?> <!-- partial --> <div class="main-panel"> <?php if ($_SERVER['REQUEST_METHOD'] == "POST") { // Collect all form data $noticeId = strip_tags( $_POST['noticeid']); $noticeTitle = strip_tags( $_POST['noticetitle']); $noticeDescription = strip_tags( $_POST['noticedescription']); // $path = strip_tags( $_POST['path']); $stmt = $conn->prepare("UPDATE notice SET Notice_Title=?, Notice_Description=? WHERE Notice_id=?"); $stmt->bind_param("ssi", $noticeTitle, $noticeDescription, $noticeId); $stmt->execute(); // echo "<script>alert('Update failed. Please try again.');</script>"; if (empty($_FILES['image']['name'])==false) { $target_dir = "../Noticeimages/"; $imageFileType = strtolower(pathinfo($_FILES['image']['name'],PATHINFO_EXTENSION)); $target_file = $target_dir . "NI_".$noticeId.".". $imageFileType; move_uploaded_file($_FILES["image"]["tmp_name"], $target_file); $target_file = "NI_".$noticeId.".". $imageFileType; $stmt = $conn->prepare("update notice set path=? where notice_id=?"); $stmt->bind_param("ss",$target_file,$noticeId ); if ($stmt->execute()) { echo "<script>alert('Notice updated successfully.'); window.location.href='noticelist.php';</script>"; exit(); } else { echo "<script>alert('Update failed. Please try again.');</script>"; } echo "<script>alert('Notice updated successfully.'); window.location.href='noticelist.php';</script>"; } } $noticeId = $_GET['id']; $data = $conn->query("SELECT * FROM notice WHERE Notice_id=$noticeId"); $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 Notice</h4> <div class="table-responsive"> <div class="card"> <div class="content"> <form class="forms-sample" method="post" autocomplete="off" enctype="multipart/form-data"> <br> <div class="col-md-10"> <div class="form-group"> <label>Notice Title</label> <input type="text" class="form-control" id="noticetitle" name="noticetitle" value="<?php if (isset($row['Notice_Title'])) echo $row['Notice_Title']; ?>" placeholder="Title" required> </div> <div class="form-group"> <label>Notice Description</label> <textarea class="form-control" id="noticedescription" name="noticedescription" placeholder="Description" required><?php if (isset($row['Notice_Description'])) echo $row['Notice_Description']; ?></textarea> </div> <div class="form-group"> <label>Notice Image/PDF</label> <input type="text" class="form-control" id="path" name="path" value="<?php if (isset($row['path'])) echo $row['path']; ?>" placeholder="Path" readonly> <input type="file" class="form-control" id="image" name="image" placeholder="Notice Details"> </div> <input type="hidden" name="noticeid" value="<?php echo $row['Notice_id']; ?>"> </div> <div class="clearfix"></div> <div class="card-footer"> <button type="submit" class="btn btn-primary mr-2">Update Notice</button> </div> </form> </div> </div> </div> </div> </div> <?php include_once('footer.php'); ?>