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/noticeadd.php
<?php include_once('../dbconfig.php'); if ($_SERVER['REQUEST_METHOD'] == "POST") { // Collect all form data $Notice_Title = strip_tags( $_POST['Notice_Title']); $Notice_Description = strip_tags( $_POST['Notice_Description']); // $path = strip_tags( $_POST['Path']); // Prepare the SQL statement $stmt = $conn->prepare("INSERT INTO notice (Notice_Title, Notice_Description) VALUES ( ?, ?)"); $stmt->bind_param("ss", $Notice_Title, $Notice_Description); $stmt->execute(); $last_id = $conn->insert_id; if (empty($_FILES['image']['name'])==false) { $target_dir = "../Noticeimages/"; $imageFileType = strtolower(pathinfo($_FILES['image']['name'],PATHINFO_EXTENSION)); $target_file = $target_dir . "NI_".$last_id.".". $imageFileType; move_uploaded_file($_FILES["image"]["tmp_name"], $target_file); $target_file = "NI_".$last_id.".". $imageFileType; $stmt = $conn->prepare("update notice set path=? where notice_id=?"); $stmt->bind_param("ss",$target_file,$last_id ); if ($stmt->execute()) { echo "<script>alert('Notice added successfully.'); window.location.href='noticelist.php';</script>"; exit(); } else { echo "<script>alert('Insert failed. Please try again.');</script>"; } } echo "<script>alert('Notice added successfully.'); window.location.href='noticelist.php';</script>"; } include_once('header.php'); ?> <div class="main-panel"> <div class="content-wrapper"> <div class="row"> <div class="col-md-12 grid-margin stretch-card"> <div class="card"> <div class="card-body"> <h4 class="card-title" style="font-size:30px">Add Notice</h4> <form class="forms-sample" method="post" autocomplete="off" enctype="multipart/form-data"> <div class="form-group"> <label>Notice Title</label> <input type="text" class="form-control" id="Notice_Title" name="Notice_Title" placeholder="Notice Title" required> </div> <div class="form-group"> <label>Notice Description</label> <textarea class="form-control" id="Notice_Description" name="Notice_Description" placeholder="Notice Description" required></textarea> </div> <div class="form-group"> <label>Notice Image/PDF</label> <input type="file" class="form-control" id="image" name="image" placeholder="Notice Details"> </div> <button type="submit" class="btn btn-primary mr-2">Add Notice</button> </form> </div> </div> </div> </div> </div> </div> <?php include_once('footer.php'); ?>