Does not insert with empty input date

0

In my form I have this field:

<h5><strong>Data da Visita</strong></h5></h5> <input type="date" id="DataVisita" name="DataVisita" />  

But if I run out of date it does not insert into the database table, and I want it to insert because I do not always have to put the date

    
asked by anonymous 09.02.2018 / 12:13

2 answers

0

If the field is not "null" in mysql, you will always have to fill that field. Change this field in your BD and the data type should be Varchar or pass variable.

Also change your field and put it like this:

<h5><strong>Data da Visita</strong></h5></h5> <input type="text" id="DataVisita" name="DataVisita" /> 

If your intention is to have the calendar, keep the input type but only change the field in the database.

    
09.02.2018 / 12:32
0
<h5><strong>Data da Visita</strong></h5></h5> <input type="date" id="DataVisita" name="DataVisita" required="off" />

Add REQUIRED="OFF"

    
09.02.2018 / 12:17