| Server IP : 13.126.101.145 / Your IP : 216.73.217.84 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ip-11-115-0-196 6.8.0-1039-aws #41~22.04.1-Ubuntu SMP Thu Sep 11 10:54:48 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 8.3.17 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/rentals_updated/wp-content/plugins/Sell Enquiry/ |
Upload File : |
<?php
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly
}
// Add the admin menu for Sell Enquiries
function sell_enquiry_admin_page() {
add_menu_page(
'Sell Enquiries',
'Sell Enquiries',
'manage_options',
'sell-enquiry-admin',
'sell_enquiry_admin_list',
'dashicons-list-view',
25
);
}
add_action('admin_menu', 'sell_enquiry_admin_page');
// Function to display the enquiry list using DataTables
function sell_enquiry_admin_list() {
global $wpdb;
$table_name = $wpdb->prefix . 'sell_enquiry';
$results = $wpdb->get_results("SELECT * FROM $table_name ORDER BY created_at DESC");
?>
<div class="wrap">
<br>
<h1>Sell Enquiries</h1>
<table id="sellEnquiriesTable" class="wp-list-table widefat fixed striped">
<thead>
<tr>
<th>Sr. No.</th>
<th>Name</th>
<th>Email</th>
<th>Phone</th>
<th>Location</th>
<th>Product</th>
<th>Additional Equipment</th>
<th>Remarks</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<?php
$sr_no = 1;
foreach ($results as $row) : ?>
<tr>
<td><?php echo $sr_no++; ?></td>
<td><?php echo esc_html($row->full_name); ?></td>
<td><?php echo esc_html($row->email); ?></td>
<td><?php echo esc_html($row->phone); ?></td>
<td><?php echo esc_html($row->location); ?></td>
<td><?php echo esc_html($row->product_name); ?></td>
<td><?php echo esc_html($row->additional_equipment); ?></td>
<td><?php echo esc_html($row->remarks); ?></td>
<td><?php echo date('d-m-Y', strtotime($row->created_at)); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<!-- Include jQuery DataTables -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css">
<script>
jQuery(document).ready(function($) {
$('#sellEnquiriesTable').DataTable({
"paging": true,
"searching": true,
"ordering": true
});
});
</script>
<?php
}