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/eventadd.php
<?php include_once('header.php'); ?> <div class="main-panel"> <?php if ($_SERVER['REQUEST_METHOD'] == "POST") { if ($_FILES["image"]["size"] > (2*1024*1024)) { echo "<script>alert('Sorry, your file is too large.');"; } else { $title = $_POST['title']; $title = strip_tags($title); $edate = $_POST['edate']; $edate = strip_tags($edate); $desc = $_POST['desc']; $desc = strip_tags($desc); $active = $_POST['active']; $active = strip_tags($active); $stmt = $conn->prepare("insert into events(EventTitle, Event_Date, Event_Description, IsActive) VALUES (?,?,?,?)"); $stmt->bind_param("ssss", $title,$edate,$desc,$active); // print_r($stmt); $stmt->execute(); $last_id = $conn->insert_id; $target_dir = "../eventimages/"; $imageFileType = strtolower(pathinfo($_FILES['image']['name'],PATHINFO_EXTENSION)); $target_file = "../eventimages/" . "E_".$last_id.".". $imageFileType; move_uploaded_file($_FILES["image"]["tmp_name"], $target_file); $target_file = "E_".$last_id.".". $imageFileType; $stmt = $conn->prepare("update events set MainImage=? where Event_Id=?"); $stmt->bind_param("ss",$target_file,$last_id ); //print_r($stmt); $stmt->execute(); echo "<script>alert('Events added successfully');window.location.href='eventlist.php';</script>"; } } ?> <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">Add Event</h4> <p class="card-description"> </p> <!-- <form method="POST" enctype="multipart/form-data"> --> <form class="forms-sample" method="post" enctype="multipart/form-data" autocomplete="off"> <br> <div class="form-group"> <label>Event Title</label> <input type="text" class="form-control" id="title" name="title" placeholder="Event Title" required> </div> <div class="form-group"> <label>Event date</label> <input type="date" class="form-control" id="edate" name="edate" placeholder="Event Date" > </div> <div class="form-group"> <label>Description</label> <textarea class="form-control" id="desc" name="desc" placeholder="Descrition"></textarea> </div> <div class="form-group"> <label>Image</label> <input type="file" class="form-control" id="image" name="image" placeholder="image"> </div> <div class="form-group"> <div class="form-group row"> <label class="col-sm-3 col-form-label">Is Active</label> <div class="col-sm-4"> <div class="form-check"> <label class="form-check-label"> <input type="radio" class="form-check-input" name="active" id="active" value="1" checked=""> Active <i class="input-helper"></i></label> </div> </div> <div class="col-sm-5"> <div class="form-check"> <label class="form-check-label"> <input type="radio" class="form-check-input" name="active" id="active" value="0"> Inactive <i class="input-helper"></i></label> </div> </div> </div> </div> <div class="clearfix"></div> <button type="submit" class="btn btn-primary mr-2">Update Event</button> </form> </div> </div> </div> </div> </div> <?php include_once('footer.php'); ?>