File: /var/www/nclive/technc/enquiry_list.php
<?php
include 'header.php';
$user_id = $_SESSION['user_id'];
$curDate = date('Y-m-d H:i:s');
$type = $_REQUEST['type'];
$noti_id = $_REQUEST['req_id'];
$array = array();
if ($type == 'delete') {
$deleteQuery = "DELETE FROM sp_contact_query WHERE id='$noti_id'";
$delete = $db->prepare($deleteQuery);
if ($delete->execute()) {
$array = array('status' => 1, 'msg' => "Deleted");
}
}
$query = "SELECT * from sp_contact_query where id !='' order by id desc";
$getData = $db->prepare($query);
$getData->execute();
?>
<script type="text/javascript" charset="utf8" src="assets/js/jquery-1.4.1.min.js"></script>
<script type="text/javascript" charset="utf8" src="assets/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" href="assets/css/jquery.dataTables.min.css">
<main id="main-container">
<div class="content content-narrow">
<div class="row">
<div class="col-lg-12">
<h2 class="content-heading">Contact Us Query List</h2>
<div class="table-responsive">
<table id="notification" class="table table-striped table-bordered dt-responsive nowrap">
<thead>
<tr class="danger">
<th>#N</th>
<th>Action</th>
<th>Name</th>
<th>Email</th>
<th>Mobile</th>
<th>Message</th>
<th>IP</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<?php while ($r = $getData->fetch()) { ?>
<tr>
<td><?php echo $r['id']; ?></td>
<td><button class="btn btn-danger" title="Delete" onclick="deleteNoti(<?php echo $r['id']; ?>)"><i class="fa fa-trash-o"></i></button></td>
<td><?php echo $r['name']; ?></td>
<td><?php echo $r['email']; ?></td>
<td><?php echo $r['mobile']; ?></td>
<td><?php echo htmlspecialchars($r['message']); ?></td>
<td><?php echo $r['user_ip']; ?></td>
<td><?php echo $r['add_date']; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<script type="text/javascript">
jQuery.noConflict();
var msg = "'Are you sure'";
jQuery(document).ready(function() {
jQuery('#notification').dataTable({
"dom": "Bfrtip",
"responsive": true,
"bPaginate": true,
"iDisplayLength": 100,
"lengthMenu": [
[100, 200, 300, 500, 1000],
[100, 200, 300, 500, 1000]
]
});
});
</script>
</div>
</div>
</div>
</div>
</main>
<script>
function deleteNoti(id) {
var r = confirm("Are you sure to Delete Notifications ?");
if (r == true) {
var site = "/technc/enquiry_list.php?req_id=" + id + "&type=delete";
jQuery.ajax({
url: site,
type: 'POST',
data: 'html',
success: function(response) {
alert("Deleted");
location.reload();
}
});
} else {
return false;
}
}
</script>
<?php include 'footer.php'; ?>