I have two parameters in my stored procedure i.e. @startdate and @enddate. The user selects startdate from text box and enddate also from text box. Then click submit.
I want to make sure if user leaves blank both the boxes, it should display data for the whole current month i.e. 01/08/2012 to 31/08/2012 now.
If user just selects date in any one of the boxes, the other text box should have the same value.
So I have declared variable as below and tried the condition but it always display data for whole month irrespective of what date is selected. I think there is a problem with my if condition.
$startdate = isset($_REQUEST['startdate']) ? $_REQUEST['startdate'] : null;
$enddate = isset($_REQUEST['enddate']) ? $_REQUEST['enddate'] : null;
if (empty($startdate)) {
$startdate = $enddate;
}
if (empty($enddate)) {
$enddate = $startdate;
}
if (empty($startdate))
;
if (empty($enddate))
;
$startdate = '01/08/2012';
$enddate = '31/08/2012';
if(empty($startdate));doesn't do anything.$startdate = '01/08/2012'; $enddate = '31/08/2012';resets$startdateand$enddate.