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/staffdetailsadd.php
<?php include_once('../dbconfig.php'); if ($_SERVER['REQUEST_METHOD'] == "POST") { // Collect all form data $Name = strip_tags($_POST['Name']); $Degree = strip_tags($_POST['Degree']); $Email = strip_tags($_POST['Email']); $ContactNo = strip_tags($_POST['ContactNo']); $Address = strip_tags($_POST['Address']); $Joining_date = strip_tags($_POST['Joining_date']); $left_date = strip_tags($_POST['left_date']); if($left_date=="") { // echo "<script>alert('NULL'); window.location.href='noticelist.php';</script>"; $left_date=null; } $Current_Status = strip_tags($_POST['Current_Status']); $Post = strip_tags($_POST['Post']); $details = strip_tags($_POST['details']); $stmt = $conn->prepare("INSERT INTO staff_details (Name, Degree, Email, ContactNo, Address, Joining_date, left_date, Current_Status, Post,details) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); $stmt->bind_param("ssssssssss", $Name, $Degree, $Email, $ContactNo, $Address, $Joining_date, $left_date, $Current_Status, $Post,$details); $stmt->execute(); $last_id = $conn->insert_id; if (empty($_FILES['image']['name'])==false) { $target_dir = "../staffimages/"; $imageFileType = strtolower(pathinfo($_FILES['image']['name'],PATHINFO_EXTENSION)); $target_file = $target_dir . "SI_".$last_id.".". $imageFileType; move_uploaded_file($_FILES["image"]["tmp_name"], $target_file); $target_file = "SI_".$last_id.".". $imageFileType; $stmt = $conn->prepare("update staff_details set image=? where id=?"); $stmt->bind_param("ss",$target_file,$last_id ); if ($stmt->execute()) { echo "<script>alert('Staff added successfully.'); window.location.href='staffdetailslist.php';</script>"; exit(); } else { echo "<script>alert('Insert failed. Please try again.');</script>"; } // Prepare the SQL statement // if ($stmt->execute()) { // echo "<script>alert('Staff member added successfully.'); window.location.href='staffdetailslist.php';</script>"; // exit(); // } else { // echo "<script>alert('Insert failed. Please try again.');</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 Staff Member</h4> <form class="forms-sample" method="post" enctype="multipart/form-data" autocomplete="off"> <div class="form-group"> <label>Name</label> <input type="text" class="form-control" id="Name" name="Name" placeholder="Name" required> </div> <div class="form-group"> <label>Degree</label> <input type="text" class="form-control" id="Degree" name="Degree" placeholder="Degree" required> </div> <div class="form-group"> <label>Email</label> <input type="email" class="form-control" id="Email" name="Email" placeholder="Email" required> </div> <div class="form-group"> <label>Contact No</label> <input type="text" class="form-control" id="ContactNo" name="ContactNo" placeholder="Contact Number" required> </div> <div class="form-group"> <label>Address</label> <input type="text" class="form-control" id="Address" name="Address" placeholder="Address" required> </div> <div class="form-group"> <label>Joining Date</label> <input type="date" class="form-control" id="Joining_date" name="Joining_date" required> </div> <div class="form-group"> <label>Left Date</label> <input type="date" class="form-control" id="left_date" name="left_date"> </div> <div class="form-group"> <label>Current Status</label> <input type="text" class="form-control" id="Current_Status" name="Current_Status" placeholder="Current Status" required> </div> <div class="form-group"> <label>Post</label> <input type="text" class="form-control" id="Post" name="Post" placeholder="Post" required> </div> <div class="form-group"> <label>Image</label> <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"></textarea> </div> <button type="submit" class="btn btn-primary mr-2">Add Staff Member</button> </form> </div> </div> </div> </div> </div> </div> <?php include_once('footer.php'); ?>