Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 464
  • Last Modified:

jquery datepicker sending current date if input empty

hello
can anyone tell me why datepicker submits the current date if the input field is empty? this date field is not a compulsory field and can be used at the users discretion. many thanks.
0
peter_coop
Asked:
peter_coop
  • 2
1 Solution
 
dirknibleckCommented:
I've never experienced this. Are you sure that the page itself is submitting the current date?

Is your server side PHP? If you use code like: date('Y/m/d', strtotime($_POST['date'])) and $_POST['date'] is blank, I believe strtotime will calculate the current date at the server...
0
 
peter_coopAuthor Commented:
thanks for reply. this is the php code:

$date_parts = explode("/",$_POST['datepicker']);
$newDate = $date_parts[2]  . "-" . $date_parts[1] . "-" . $date_parts[0];
$datepicker = date('Y/m/d', strtotime($newDate));
0
 
peter_coopAuthor Commented:
thank you
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now