Im trying to use jquery datepicker to query my data im database and show on webpage.
Here is my code. I dont know what is wrong. Im stuck on this point for days.
Code: Select all
</head>
<body>
<script type="text/javascript" language="javascript">
jQuery(function() {
jQuery( "#from" ).datepicker({
defaultDate: "+0w",
changeMonth: true,
numberOfMonths: 1,
onClose: function( selectedDate ) {
$( "#to" ).datepicker( "option", "minDate", selectedDate );
}
});
jQuery( "#to" ).datepicker({
defaultDate: "+0w",
changeMonth: true,
numberOfMonths: 1,
onClose: function( selectedDate ) {
jQuery( "#from" ).datepicker( "option", "maxDate", selectedDate );
}
});
});
</script>
<form action="" method="post">
<label style="margin: 0 10px 0 20px;" for="from">From</label>
<input style="padding: 3px; border-radius: 4px; opacity: none; background: #EEEEEE;" type="text" id="from" name="from" />
<label style="margin-left: 10px;" for="to">To</label>
<input style="padding: 3px; border-radius: 4px; background: #EEEEEE;" type="text" id="to" name="to" />
<input type="submit" name="filterDate" value="Submit" />
</form>
<?php
include 'dbconfig.php';
extract($_POST);
$sql1=mysql_query("Select Relhum from realtime where date between '".$from_date." and '".$to_date."'");
echo "<table border='1'>
<tr>
<th>Relhum</th>
</tr>";
while($row = mysql_fetch_array($sql1))
{
echo "<tr>";
echo "<td>" . $row['Relhum'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>
</body>