D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
u384067285
/
domains
/
cauldronsisterss.com
/
public_html
/
admin
/
Filename :
edit_blog.php
back
Copy
<?php session_start(); error_reporting(0); include 'connection.php'; if (isset($_POST['update'])) { /* Fetch Requests from input box */ $post_date = htmlentities($_POST['post_date']); $post_title = htmlentities($_POST['post_title']); $post_title = addslashes($post_title); $editor = $_POST['editor']; $filename = $_FILES["image1"]["name"]; $tempname = $_FILES["image1"]["tmp_name"]; $folder = "images/blog/".$filename; /* Add Requests */ $eid = $_GET['editid']; /* Update Requests */ $sql = "UPDATE tblpost SET post_date = '$post_date', post_title = '$post_title', editor = '$editor', image1 = '$filename' WHERE post_title = '$eid'"; if ($conn->query($sql) === TRUE) { $msg = "Post Updated Successfully"; } else { $msg = $conn->error; } } ?> <!DOCTYPE html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>Cauldron Sisterss | Edit Blog</title> <!-- plugins:css --> <link rel="stylesheet" href="vendors/feather/feather.css"> <link rel="stylesheet" href="vendors/mdi/css/materialdesignicons.min.css"> <link rel="stylesheet" href="vendors/ti-icons/css/themify-icons.css"> <link rel="stylesheet" href="vendors/typicons/typicons.css"> <link rel="stylesheet" href="vendors/simple-line-icons/css/simple-line-icons.css"> <link rel="stylesheet" href="vendors/css/vendor.bundle.base.css"> <!-- endinject --> <!-- Plugin css for this page --> <link rel="stylesheet" href="vendors/select2/select2.min.css"> <link rel="stylesheet" href="vendors/select2-bootstrap-theme/select2-bootstrap.min.css"> <!-- End plugin css for this page --> <!-- inject:css --> <link rel="stylesheet" href="css/vertical-layout-light/style.css"> <!-- endinject --> <?php include 'favicon.php'; ?> <script src = "ckeditor/ckeditor.js"></script> </head> <body> <div class="container-scroller"> <!-- partial:../../partials/_navbar.php --> <?php include 'header.php'; ?> <!-- partial --> <div class="container-fluid page-body-wrapper"> <!-- partial:../../partials/_sidebar.html --> <?php include 'sidebar.php'; ?> <!-- partial --> <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">Update Post <span style = "color:red;"> <?php echo $msg; ?> </span> </h4> <form class="forms-sample" method="post" enctype="multipart/form-data"> <?php $cid = $_GET['editid']; $sql = "SELECT * FROM tblpost WHERE post_title = '$cid'"; $result = $conn->query($sql); while ($row = mysqli_fetch_array($result)) { ?> <div class="form-group"> <label for="name">Post Title</label> <input type="text" class="form-control" id="name" placeholder="Name" value = "<?php echo $row['post_title']; ?>" name="post_title" required> </div> <div class="form-group col-lg-6"> <label for="date">Date</label> <input type="date" class="form-control" id="date" name="post_date" value = "<?php echo $row['post_date']; ?>" required> </div> <div class="form-group col-lg-6"> <label for="image1">Post Image</label> <input type="file" class="form-control" id="image1" name="image1" value = "<?php echo $row['image1']; ?>"> </div> <div class="form-group col-lg-6"> <img height = "50" width = "50" src="images/blog/<?php echo $row['image1']; ?>" alt="<?php echo $row['image1']; ?>"> </div> <div class="form-group"> <label for="description">Post Description</label> <textarea placeholder = "Description" name = "editor" class="form-control"><?php echo $row['editor']; ?></textarea> </div> <button type="submit" class="btn btn-primary me-2" name="update">Update</button> <a href="blog.php" class="btn btn-primary me-2">Back</a> <?php } ?> </form> </div> </div> </div> </div> <!-- Manage Company Contact --> <div class="row"> <div class="col-lg-12 grid-margin stretch-card"> <div class="card"> <div class="card-body"> <h4 class="card-title">Manage Post </h4> <div class="table-responsive"> <table class="table table-hover"> <thead> <tr> <th>#</th> <th>Date</th> <th>Post Title</th> <th>Action</th> </tr> </thead> <tbody> <?php $cid = $_GET['editid']; $sql = "SELECT * FROM tblpost WHERE post_title = '$cid'"; $result = $conn->query($sql); $cnt = 1; while ($row = mysqli_fetch_array($result)) { ?> <tr> <td><?php echo $cnt; ?></td> <td><?php echo $row['post_date']; ?></td> <td><?php echo $row['post_title']; ?></td> <td> <label class="badge badge-warning"> <a href = "edit_blog.php?editid=<?php echo $row['post_title']; ?>" style="text-decoration:none; color:black;">Edit</a> </label> <label class="badge badge-danger"> <a href = "delete_blog.php?id=<?php echo $row['post_title']; ?>" style="text-decoration:none; color:black;">Delete</a> </label> </td> </tr> <?php $cnt = $cnt + 1; } ?> </tbody> </table> </div> </div> </div> </div> </div> </div> <!-- content-wrapper ends --> <!-- partial:../../partials/_footer.html --> <?php include 'footer.php'; ?> <!-- partial --> </div> <!-- main-panel ends --> </div> <!-- page-body-wrapper ends --> </div> <!-- container-scroller --> <!-- Script --> <!-- plugins:js --> <script src="vendors/js/vendor.bundle.base.js"></script> <!-- endinject --> <!-- Plugin js for this page --> <script src="vendors/typeahead.js/typeahead.bundle.min.js"></script> <script src="vendors/select2/select2.min.js"></script> <script src="vendors/bootstrap-datepicker/bootstrap-datepicker.min.js"></script> <!-- End plugin js for this page --> <!-- inject:js --> <script src="js/off-canvas.js"></script> <script src="js/hoverable-collapse.js"></script> <script src="js/template.js"></script> <script src="js/settings.js"></script> <script src="js/todolist.js"></script> <!-- endinject --> <!-- Custom js for this page--> <script src="js/file-upload.js"></script> <script src="js/typeahead.js"></script> <script src="js/select2.js"></script> <!-- End custom js for this page--> <script> CKEDITOR.replace('editor'); </script> </body> </html>