D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
buildteksolution
/
public_html
/
superadmin
/
Filename :
edit-slider.php
back
Copy
<?php include 'cn.php'; session_start(); $sno=$_GET["id"]; $sql1 = "SELECT * FROM sliders WHERE id='$sno'" ; $result1 = $con->query($sql1); $row1 = $result1->fetch_assoc(); if(isset($_SESSION['username'])) { if(isset($_POST['submit'])) { date_default_timezone_set('Asia/Kolkata'); $curdate= date('d-m-Y H:i'); if( $_FILES['img']['name']==''){ $imageName=$row1['slider']; } else { $image =$_FILES['img']['tmp_name']; $imageName =$_FILES['img']['name']; $imageSize =$_FILES['img']['size']; $imageType =$_FILES['img']['type']; $target_dir = "slider1/"; $target_file = $target_dir . basename($_FILES["img"]["name"]); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION)); move_uploaded_file($_FILES["img"]["tmp_name"],$target_dir.$imageName); } /* echo $imageName; echo $_POST['name']; echo $_POST['price']; echo $_POST['category']; echo $_POST['description']; echo $_POST['pid'];die;*/ $query1 ="UPDATE `sliders` SET `slider`='".$imageName."',`title`='".$_POST['title']."',`subtitle`='".$_POST['subtitle']."',`slides`='".$_POST['slides']."' WHERE id='$sno'"; $result=mysqli_query($con,$query1); echo "<script type='text/javascript'>alert(\"Updated Successfully\") location.href='all-sliders.php'; </script>"; } ?> <!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" /> <link rel="stylesheet" href="https://cdn.datatables.net/1.11.3/css/dataTables.bootstrap4.min.css" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.2/css/bootstrap.css" crossorigin="anonymous"> <title>Jireh Tech</title> <link rel="icon" href="https://jireh-tech1.com/assets/images/fav.png"> <style> .scrollbar{ overflow:auto ; white-space: nowrap; } </style> </head> <body> <div class="container-scroller"> <?php include 'header.php'; ?> <!-- partial --> <div class="main-panel"> <div class="content-wrapper pb-0"> <div class="col-12 grid-margin stretch-card"> <div class="card"> <div class="card-body"> <h4 class="card-title">Edit Slider</h4> <!-- <p class="card-description">Basic form elements</p> --> <form class="forms-sample" method="post" enctype="multipart/form-data"> <div class="form-group"> <label for="exampleInputName1">Slider Image</label><img src="slider1/<?php echo $row1['slider']; ?>" height="100" width="100"> <input type="file" name="img" class="form-control"> </div> <div class="form-group"> <label for="exampleInputName1">Title</label> <input type="text" class="form-control" name="title" placeholder="Name" value="<?php echo $row1['title']; ?>" /> </div> <div class="form-group"> <label for="exampleInputName1">Subtitle</label> <input type="text" class="form-control" name="subtitle" placeholder="Name" value="<?php echo $row1['subtitle']; ?>" /> </div> <div class="form-group"> <label for="exampleInputName1">Slider No</label> <input type="text" class="form-control" name="slides" placeholder="Price" value="<?php echo $row1['slides']; ?>" readonly /> </div> <button type="submit" class="btn btn-primary me-2" name="submit"> Submit </button> </form> </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 src="https://code.jquery.com/jquery-3.5.1.js"></script> <script src="https://cdn.datatables.net/1.11.3/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/1.11.3/js/dataTables.bootstrap4.min.js"></script> <script> $(document).ready(function() { $('#example').DataTable(); } ); </script> <script> // $(".deleteRecord").click(function(e) { // var e_id = $(this).data("id"); // $.ajax({ // url: "new-action.php", // type: 'post', // data: { 'e_id':e_id }, // success: function(response) { // // console.log(response); // if(response == 1) { // alert(\"Deleted Successfully!.\") // location.href='index.php'; // // $('#mytablerow').remove(); // }else if(response == 0){ // // swal("Great","Item added To your Cart", "success"); // } // } // }); // }); </script> </body> </html> <?php } else { header("location:login.php"); } ?>