jquery datepicker sending current date if input empty

Posted on 2010-08-26
Last Modified: 2012-05-10
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.
Question by:peter_coop
  • 2
LVL 15

Accepted Solution

dirknibleck earned 250 total points
ID: 33537853
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...

Author Comment

ID: 33540086
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));

Author Closing Comment

ID: 33541800
thank you

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question