Question : empty date field

g'day

i am trying to insert a blank date into mysql field which date format and null. however, i do not think that my code is correct because although the session is blank when it arrives at the process page, it changes it to todays date. the reason i need to check for empty session is because a user can skip the date and leave it blank. if they enter a date the posted code works ok. can you check the code and tell me where it is wrong? many thanks

1:
2:
3:
4:
$destdate='';
if(isset($_SESSION['datepick']) && $_SESSION['datepick'] != ""){
$destdate = date("Y-m-d", strtotime($_SESSION['datepick']));
}

Answer : empty date field

check for empty...
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
$datepicker='';
if(empty($_POST['datepicker'])){
}
else
{
$datepicker = $_POST['datepicker'];
$_SESSION['datepick'] = $datepicker;
}


echo 'The date: ' . $_SESSION['datepick'];
Random Solutions  
 
programming4us programming4us