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/eventupdate.php
<?php include_once('header.php'); ?> <div class="main-panel"> <?php if ($_SERVER['REQUEST_METHOD'] == "POST") { $id=$_GET['id']; $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("update events set EventTitle=?, Event_Date=?, Event_Description=?, IsActive=? where Event_Id =?"); $stmt->bind_param("sssss", $title,$edate,$desc,$active,$id); // print_r($stmt); $stmt->execute(); if(!empty($_FILES['image']['name'])){ $target_dir = "../eventimages/"; $imageFileType = strtolower(pathinfo($_FILES['image']['name'],PATHINFO_EXTENSION)); $target_file = "../eventimages/" . "E_".$id.".". $imageFileType; move_uploaded_file($_FILES["image"]["tmp_name"], $target_file); $target_file = "E_".$id.".". $imageFileType; $stmt = $conn->prepare("update events set MainImage=? where Event_Id =?"); $stmt->bind_param("ss", $target_file,$id); // print_r($stmt); $stmt->execute(); } echo "<script>alert('Events updated successfully');window.location.href='eventlist.php';</script>"; } else { if(isset($_GET['id'])) { $id=$_GET['id']; $sql = "select * from events where Event_Id ='$id'"; $rs = $conn->query($sql); $row = $rs -> fetch_assoc(); // print_r($row); } } ?> <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">Update Event</h4> <p class="card-description"> </p> <!-- <form method="POST" enctype="multipart/form-data"> --> <form class="forms-sample" method="post" enctype="multipart/form-data"> <br> <div class="form-group"> <label>Event Title</label> <input type="text" class="form-control" id="title" name="title" value="<?php if (isset($row['EventTitle'])) echo $row['EventTitle'];?>" placeholder="Event Title" required> </div> <div class="form-group"> <label>Event date</label> <input type="date" class="form-control" id="edate" name="edate" value="<?php if (isset($row['Event_Date'])) echo $row['Event_Date'];?>" placeholder="Event Date" > </div> <div class="form-group"> <label>Description</label> <textarea class="form-control" id="desc" name="desc" placeholder="Descrition"><?php if (isset($row['Event_Description'])) echo $row['Event_Description'];?></textarea> </div> <div class="form-group"> <label>Image</label> <img src="../eventimages/<?php if (isset($row['MainImage'])) echo $row['MainImage'];?>" width="100px"> <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" <?php if (isset($row['IsActive'])) if($row['IsActive']=="1") echo "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" <?php if (isset($row['IsActive'])) if($row['IsActive']=="0") echo "checked";?>> 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'); ?>