I'm trying to sort the data table via date picker range (server side) but can't get the date sorting part to work properly. Surely there are missing codes and other problems.
What am I missing?
<html lang="en">
<head>
<title>List</title>
<script src="jquery-3.3.1.min.js"></script>
</head>
<body>
<h1 align="center">List</h1>
</br>
</br>
</br>
<center> <p class="search_input">
<form method="post" action="#">
<input type="date" name="dateFrom"> <input type="date" name="dateTo">
<input type="submit" name="range" id="range" class="btn-info" />
</form>
</center>
<table align="center" cellspacing="0" cellpadding="0">
<thead class="fixedthead">
<th width="120px" style="text-align: center; color: navy">Name</th>
<th width="120px" style="text-align: center; color: navy">Description</th>
<th width="120px" style="text-align: center; color: navy">Date</th>
<th width="120px" style="text-align: center; color: navy">Open</th>
</thead>
<?php
//retrieve content via data picker range
$dateFrom = $_POST['dateFrom'];
$dateTo = $_POST['dateTo'];
$conn = mysqli_connect("localhost", "root", "", "order");
// get results from database
$result = mysqli_query($conn, "SELECT * FROM order.item WHERE date BETWEEN '$dateFrom' AND '$dateTo' ", MYSQLI_USE_RESULT)
or die(mysqli_error($conn));
while($row = mysqli_fetch_array( $result )) {
?>
<tbody>
<tr>
<td width="120px" style="text-align: center"><?php echo $row['name']; ?></td>
<td width="120px" style="text-align: center"><?php echo $row['description']; ?></td>
<td width="120px" style="text-align: center"><?php echo $row['date']; ?></td>
<td width="120px"><a href = "download.php?id=<?php echo $row['id']; ?>" style='text-decoration:none;'><button>View</button></a></td>
</tr>
</tbody>
</table><br><br><br>
<?php
}
?>
</body>
</html>
Any help is appreciated. Thanks guys!