D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
realadss
/
gurgaon.jaipurpartyplanner.in
/
admin
/
Filename :
banner.php
back
Copy
<?php include('include/header.php'); $sn=1; if(isset($_POST[add])){ $filename = $_FILES['image']['name']; $tmpname = $_FILES['image']['tmp_name']; $unique = uniqid()." ".$filename; $store = "images/product/".$unique; move_uploaded_file($tmpname,$store); $bannertitle =$_POST['title']; $banneralt =$_POST['alt']; $date = date('Y/m/d'); $data= mysqli_query($conn,"insert into banner (id,image,image_title,image_alt,createdate) values(' ','$store','$bannertitle','$banneralt','$date')"); // print_r($data); // die; if($data){ echo "<script> alert('Banner Added');window.location.href='banner.php'</script>"; } else{ echo "<script> alert('Please try again')</script>"; } } ?> <style> .box-body img{ /* width: 100%;*/ /*height: 100px;*/ /*object-fit: contain;*/ width: 100px; height: 50px; object-fit: cover; } .list-wrapper { padding: 15px; overflow: hidden; } </style> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <div class="container-full"> <!-- Content Header (Page header) --> <div class="content-header"> <div class="d-flex align-items-center"> <div class="me-auto"> <!--<h4 class="page-title">Add Category</h4>--> </div> </div> </div> <!-- Main content --> <section class="content"> <div class="box"> <div class="box-body"> <div class="box-header with-border"> <h4 class="box-title">Home Banner</h4> </div> <form role="form" method="POST" enctype="multipart/form-data"> <!-- text input --> <div class="row"> <div class="col-4"> <div class="form-group"> <label class="form-label">Banner Image</label> <input type="file" class="form-control" accept="image/png, image/jpeg, image/jpg" name="image" onchange="ShowImage(event)" required> <!--<img src="" height="100px" id="image" />--> </div> </div> <div class="col-4"> <div class="form-group"> <label class="form-label">Image title</label> <input type="text" class="form-control" placeholder="Enter Category...." name="title" required> </div> </div> <div class="col-4"> <div class="form-group"> <label class="form-label">Image Alt</label> <input type="text" class="form-control" placeholder="Enter Category...." name="alt" required> </div> </div> </div> <div class="box-footer"> <button type="submit" class="btn btn-success" name="add">Add</button> </div> </form> <div class="box"> <div class="box-body no-padding"> <div class="table-responsive"> <input type="hidden" id="deleteId"> <input type="search" placeholder="Search By Keyword ..." class="form-control search-input my-3" data-table="customers-list"/> <table class="table table-hover customers-list list-wrapper" > <tbody id="showdata"> <tr> <th>Id</th> <th>Banner Image</th> <th>Banner Title</th> <th colspan="2" class="text-center">Action</th> </tr> <?php $query = "SELECT * FROM banner"; $catData = mysqli_query ($conn, $query); while ($row=mysqli_fetch_array($catData)) { ?> <tr class="list-item"> <td><?php echo $sn++; ?></td> <td><?php echo "<img src='".$row['image']."' >"; ?></td> <td><?php echo $row['image_title']; ?></td> <td><button type="button" class="waves-effect waves-light btn btn-rounded btn-success mb-5 ed-btn"><?php echo "<a href='banner-edit.php?eid=".$row['id']."'>Edit</a>";?></button></td> <td><button type="button" class="waves-effect waves-light btn btn-rounded btn-danger mb-5 ed-btn"><a onclick="openDeleteModal(<?php echo $row['id']; ?>)" href="javascript:void(0);" data-bs-toggle="modal" data-bs-target="#delete-item">Delete</a></button></td> </tr> <?php }?> </tbody></table> </div> </div> </div> </div> </div> </section> <!-- /.content --> <!-- Delete --> <div class="modal fade" id="delete-item" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered "> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Delete Categories</h5> <button type="button" class="btn-close close-modal" data-bs-dismiss="modal" aria-label="Close"> <i class="fe fe-x"></i> </button> </div> <div> <div class="modal-body py-0"> <div class="del-modal"> <p>Are you sure want to Delete?</p> </div> </div> <div class="modal-footer pt-0"> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button> <button type="submit" onclick="confirmDelete()" class="btn btn-primary">Yes</button> </div> </div> </div> </div> </div> <!-- /Delete --> <script> function openDeleteModal(id) { document.getElementById('deleteId').value = id; } function confirmDelete() { // Get the stored ID var id = document.getElementById('deleteId').value; window.location.href = 'banner-delete.php?did=' + id; } </script> </div> </div> <!-- /.content-wrapper --> <?php include('include/footer.php') ?> <script> (function(document) { 'use strict'; var TableFilter = (function(myArray) { var search_input; function _onInputSearch(e) { search_input = e.target; var tables = document.getElementsByClassName(search_input.getAttribute('data-table')); myArray.forEach.call(tables, function(table) { myArray.forEach.call(table.tBodies, function(tbody) { myArray.forEach.call(tbody.rows, function(row) { var text_content = row.textContent.toLowerCase(); var search_val = search_input.value.toLowerCase(); row.style.display = text_content.indexOf(search_val) > -1 ? '' : 'none'; }); }); }); } return { init: function() { var inputs = document.getElementsByClassName('search-input'); myArray.forEach.call(inputs, function(input) { input.oninput = _onInputSearch; }); } }; })(Array.prototype); document.addEventListener('readystatechange', function() { if (document.readyState === 'complete') { TableFilter.init(); } }); })(document); </script>