Php:使用日历值从数据库中获取记录

I have a php file with username and password. When the user login the login information will be stored in login table as datetime format. (ex: 2010-05-21 15:05:55) and in the same way logout details will be stored. Now i would like to list the user information datewise. Hence, I use calendar function as

<body>
    <label>StartDate :&nbsp;</label><input name="startdate" type="text" onClick="displayDatePicker('startdate')">
    <label>EndDate :&nbsp;</label><input name="enddate" type="text" onClick="displayDatePicker1('enddate')">
</body>

Now my requirement is when the user chooses the from date and to date the login and logout informations on that particular date needs to be displayed in a table format. I tried something like

$start=$_POST['startdate']; 
$end=$_POST['enddate']; 
$sql1 = "SELECT * FROM table WHERE LoginTime = '$startdate' AND LogoutTime = '$enddate' ";

but it return null. Can u please tell me how to fetch record from database using the calendar values?

You can try this sql query

SELECT * FROM (LoginTime>=$startdate AND LoginTime<=$enddate) OR (LogoutTime>=$startdate AND LogoutTime<=$enddate)