HTML5 Input Date into Database using IE

Hi,

I have created an appointment form and I would like the user to request a date. However, when the end-user uses the form in IE, the date will not go into my database.

Form:
<input type="date" name="date" value size="35">

In my database I have my column setup as “date”.

Does anyone know how to fix this problem so the date will input into the database.

My php to send the data to my database for the date is $_POST[date],

If I use Chrome, the date goes into the database without any issues.

Thanks for your help.

Hi there @mickeyatty1 and welcome to the forums!

This suggests to me that it is not a PHP problem but a JavaScript one… potentially there is an incompatible script that fails for IE… but I would not really know without being able to look at the site or the code, do you have a link by any chance?

It might actually be that the version of IE does not support the date input. Take a look at this thread:

I think it might contain some useful information and you should be able to fix it with a polyfill.

Hope that helps

1 Like

If anyone else runs into this problem, here is the script that worked.

<script type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js"></script> 
<script src="//cdn.jsdelivr.net/webshim/1.14.5/polyfiller.js"></script>
<script>
webshims.setOptions('forms-ext', {types: 'date'});
webshims.polyfill('forms forms-ext');
$.webshims.formcfg = {
en: {
    dFormat: '-',
    dateSigns: '-',
    patterns: {
        d: "yy-mm-dd"
    }
}
};
</script>
<input type="date" />
2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.