Does not insert with empty date input

Asked

Viewed 144 times

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 you run out of date, you don’t enter it in the database table, and I want you to enter it because I don’t always have to date it

  • You put not null in the date field when creating the table ?

  • No, I put default null

  • Which error is thrown when trying to insert ?

  • No error, empty line

  • Not saved in the bank, and there is no mistake ?

  • No, how do I do the echo of that input to see the error?

  • I can see the PHP code that validates the form?

Show 2 more comments

2 answers

0

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

Add the REQUIRED="OFF"

  • If you put the REQUIRED="OFF" asks me to fill in the field

0


If the field is set to "not null" in mysql, you must always fill in this field. Change this field in your BD and the data type should be Varchar or switch to variable.

Also change your field and put like this:

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

If you want to have the calendar, keep the input type but only change the field in the database.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.