I have tried most if not all of the suggestions on this forum, as well as a few others, but I'm still getting 0000-00-00 in MySQL DB even though it echos back correct format.
Here is the PHP code:
<?php
include_once("includes/form_functions.php");
// START FORM PROCESSING
if (isset($_POST['submit'])) { // Form has been submitted.
$errors = array();
// perform validations on the form data
$required_fields = array('location', 'date');
$errors = array_merge($errors, check_required_fields($required_fields, $_POST));
$location = trim(mysql_prep($_POST['location']));
$date = mysql_prep($_POST['date']);
$adult = mysql_prep($_POST['adult']);
$child = mysql_prep($_POST['children']);
$guest = mysql_prep($_POST['guest']);
$hg = mysql_prep($_POST['holyghost']);
$baptism = mysql_prep($_POST['baptism']);
if ( empty($errors) ) {
$query = "INSERT INTO attendance (
location, date, adult, children, guest, holyghost, baptism
) VALUES (
'{$location}', {$date}, {$adult}, {$child}, {$guest}, {$hg}, {$baptism}
)";
$result = mysql_query($query, $connection);
if ($result) {
$message = "submission completed.";
} elseif
($message = "This form cannot be submitted at this time.");
$message .= "<br />" . mysql_error();
}
}
?>
Here is the datepicker code:
<head>
<link rel="stylesheet" href="stylesheets/jquery-ui.css" />
<script src="javascripts/jquery-ui-1.10.2/jquery-1.9.1.js"></script>
<script src="javascripts/jquery-ui-1.10.2/ui/jquery-ui.js"></script>
<script type="text/javascript">
$(function() {
$( "#datepicker" ).datepicker({
dateFormat: "yy-mm-dd"
});
});
</script>
</head>
Any Help would be appreciated.