PHP, how to write blank Date field in database?

0

My situation is as follows in localhost, bd, ignores the letters in the field date (dd / mm / yyyy), but when I upload to the server, it gives the error, as I'm sure it tries to write the letters of these date fields.

Well, the problem is that I use a form just to register and change, so I use the value field to return the value of the table when I'm going to change it, so I can not use the value to put default values such as 00/00/0000, and I could not get another way to cause the date field not FILLED to write the ZEROS ON table instead of giving error.

In the database the date field, this is to accept the values as follows 0000-00-00, (the date inversions are working correctly).

and the field in the form looks like this:

<input class="form-control" type="date" name="data_dc" id="data_dc" value="<?=$obreiro_busca['data_dc']?>" style="width:360px">

Like this one in BD:

 'data_dc' date DEFAULT '0000-00-00',

and this is the error:

Incorrect date value: '' for column 'data_dc' at row 1

I can not get the field to have ZEROS, instead of letters.

I just can not use the value field.

    
asked by anonymous 06.09.2018 / 22:11

0 answers