D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
buildteksolution
/
public_html
/
superadmin
/
Filename :
edit-image.php
back
Copy
<?php include 'cn.php'; session_start(); $sno=$_GET["id"]; $sql1 = "SELECT * FROM gallery 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['file1']['name']==''){ $filename1 = $row1['image1']; }else{ $filename1 = $_FILES['file1']['name']; move_uploaded_file($_FILES['file1']['tmp_name'],'image1/'.$filename1); } if($_FILES['file2']['name']==''){ $filename2 = $row1['image2']; }else{ $filename2 = $_FILES['file2']['name']; move_uploaded_file($_FILES['file2']['tmp_name'],'image2/'.$filename2); } if($_FILES['file3']['name']==''){ $filename3 = $row1['image3']; }else{ $filename3 = $_FILES['file3']['name']; move_uploaded_file($_FILES['file3']['tmp_name'],'image3/'.$filename3); } if($_FILES['file4']['name']==''){ $filename4 = $row1['image4']; }else{ $filename4 = $_FILES['file4']['name']; move_uploaded_file($_FILES['file4']['tmp_name'],'image4/'.$filename4); } if($_FILES['file5']['name']==''){ $filename5 = $row1['image5']; }else{ $filename5 = $_FILES['file5']['name']; move_uploaded_file($_FILES['file5']['tmp_name'],'image5/'.$filename5); } if($_FILES['file6']['name']==''){ $filename6 = $row1['image6']; }else{ $filename6 = $_FILES['file6']['name']; move_uploaded_file($_FILES['file6']['tmp_name'],'image6/'.$filename6); } /* echo $imageName; echo $_POST['name']; echo $_POST['price']; echo $_POST['category']; echo $_POST['description']; echo $_POST['pid'];die;*/ $query1 ="UPDATE `gallery` SET `title`='".$_POST['title']."',`image1`='".$filename1."',`image2`='".$filename2."',`image3`='".$filename3."',`image4`='".$filename4."',`image5`='".$filename5."',`image6`='".$filename6."' WHERE id='$sno'"; $result=mysqli_query($con,$query1); echo "<script type='text/javascript'>alert(\"Updated Successfully\") location.href='images.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-tech1</title> <link rel="icon" href="https://jireh-tech1.com/demo/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 Image</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">Title</label> <input type="text" class="form-control" placeholder="Ttile" required="" name="title" value="<?php echo $row1['title']; ?>"> </div> <div class="form-group"> <label for="exampleInputName1">Image 1</label> <input type="file" class="form-control" name="file1" id="file1" > <img src="image1/<?php echo $row1['image1']; ?>" style="width:100px;height:100px;"/> </div> <div class="form-group"> <label for="exampleInputName1">Image 2</label> <input type="file" class="form-control" name="file2" id="file2" > <img src="image2/<?php echo $row1['image2']; ?>" style="width:100px;height:100px;"/> </div> <div class="form-group"> <label for="exampleInputName1">Image 3</label> <input type="file" class="form-control" name="file3" id="file3" > <img src="image3/<?php echo $row1['image3']; ?>" style="width:100px;height:100px;"/> </div> <div class="form-group"> <label for="exampleInputName1">Image 4</label> <input type="file" class="form-control" name="file4" id="file4" > <img src="image4/<?php echo $row1['image4']; ?>" style="width:100px;height:100px;"/> </div> <div class="form-group"> <label for="exampleInputName1">Image 5</label> <input type="file" class="form-control" name="file5" id="file5" > <img src="image5/<?php echo $row1['image5']; ?>" style="width:100px;height:100px;"/> </div> <div class="form-group"> <label for="exampleInputName1">Image 6</label> <input type="file" class="form-control" name="file6" id="file6" > <img src="image6/<?php echo $row1['image6']; ?>" style="width:100px;height:100px;"/> </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"); } ?>