it is my html code
<div class="required" id="join_form">
<label for="DOB">DateOfBirth:</label>
<input type="date" name="date" id="date" required pattern="(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d" aria-required="true" aria-describedby="age-format" max="2004-12-31" min="1940-12-31" />
<span id="age-format" class="help" align="center">Format: mm/dd/yyyy, mm-dd-yyyy, mm.dd.yyyy, mm dd yyyy</span>
</div>
javascript to validate this type=date in other browsers
var mydate = document.getElementById('date'),
mydateError = document.getElementById('age-format');
mydate.addEventListener('input', function() {
if (!mydate.value.match(/\d{4}-\d{1,2}-\d{1,2}/)) {
mydateError.innerHTML = 'Please specify a valid date in the form 1940-2004 ';
mydateError.style.display = 'inline-block;font-size:6pt;text-align:center;';
} else {
var value = new Date(date.value),
min = new Date(date.min),
max = new Date(date.max);
if (value < min || value > max) {
mydateError.innerHTML = 'Date has to be between ' + min.toDateString() + ' and ' + max.toDateString();
mydateError.style.display = 'inline-block';
} else {
mydateError.style.display = 'none';
}
}
});
php validation and insert for date
$DOB=mysql_real_escape_string($_POST['date']);
$sql="INSERT INTO register(DOB) VALUES("$DOB");
i want to get whole date of birth like mm/dd/year but in my database i am only getting year like 1970 or 1987 like that....i cant figure out where i got wrong