Hi,
I have a script, what I want it to do is,
the user selects the dates via a javascript calendar. Then submits on a form.
The posted data then forms part of the SQL query, and the results are displayed.
Form
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Calendar Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" src="calendarDateInput.js">
</script>
</head>
<body>
<form ACTION="Test.php" METHOD="POST">
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">Start Date:</font>
<script>DateInput('StartDate', true, 'DD/MM/YYYY')</script>
<!-- <input type="button" onClick="alert(this.form.StartDate.value)" value=" Start Date"> !-->
<br>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">End Date:</font>
<script>DateInput('EndDate', true, 'DD/MM/YYYY')</script>
<!-- <input type="button" onClick="alert(this.form.EndDate.value)" value="End Date"> !-->
<br><input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>
PHP Script
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Picklist Stats</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?
require('config.php');
$db = mysql_connect ($dbhost, $dbusername, $dbpasswd);
mysql_select_db ($database_name) or die ("Cannot connect to database");
// Get info from POST
$Start = $POST['StartDate'];
$End = $POST['EndDate'];
$Startdate = date("Y-m-d",strtotime($Start));
$Enddate = date("Y-m-d",strtotime($End));
$sql3 = "SELECT * , Count(picklist.Initial) AS CInitial from picklist
LEFT JOIN warehouseops ON picklist.Initial=warehouseops.Initial
WHERE picklist.PDate Between '$Startdate' and '$Enddate'
GROUP BY picklist.Initial
ORDER BY CInitial DESC
"; ?>
<table width="609" border="0">
<tr bgcolor="#304090">
<th colspan="4" scope="col"><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">You Have Chosen </font></th>
</tr>
<tr>
<td width="103"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Start Date :</strong> </font></td>
<td width="192"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><? Echo $Startdate; ?></font></td>
<td width="81"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>End Date</strong>: </font></td>
<td width="215"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><? Echo $Enddate; ?></font></td>
</tr>
</table>
<?
$res3 = mysql_query($sql3) or die(mysql_error());
if(mysql_num_rows($res3) > 0) {
echo "<br>";
echo "<table border='1' cellspacing='0' bordercolor='#000066' width='415' cellpadding='0'>";
echo "<td height='20' width='120' bgcolor='#304090' bordercolor='#FFFFFF'><font face='Verdana' size='2' color='#FFFFFF'><centre><b>Pickers Initials</b></centre></font></td><td height='20' width='100' bgcolor='#304090' bordercolor='#FFFFFF'><font face='Verdana' size='2' color='#FFFFFF'><b>Picker</b></font></td><td height='20' width='100' bgcolor='#304090' bordercolor='#FFFFFF'><font face='Verdana' size='2' color='#FFFFFF'><b>Total Picks</b></font></td>";
while($row=mysql_fetch_array($res3)) {
echo "<tr>";
echo "<td height='20' width='100' bgcolor='#EFF3F7' bordercolor='#FFFFFF'><font face='Verdana' size='1'>".$row['Initial']."</font></a></td><td height='20' width='100' bgcolor='#EFF3F7' bordercolor='#FFFFFF'><font face='Verdana' size='1'>".$row['Name']."</font></td></td><td height='20' width='100' bgcolor='#EFF3F7' bordercolor='#FFFFFF'><font face='Verdana' size='1'>".$row['CInitial']."</font></td></td>";
echo "</tr>";
} echo "</table>";
}
else {
echo"<br>";
echo "No records found ";
}
// End Of Daily Status
?>
</p>
<p><br>
<a href="Form2.htm">back</a>
</p>
</body>
</html>
The Calender posts the correct dates.
But if i select both the same dates, ie 9, Jun , 2005 for both start and end dates I get:
Form Entry

Results:

Even though

Is there something wrong with my SQL part? Also I cant get from the 7th to the 9th jun for some reason.
Any help would be great.