2
I have a customer registration page with a field for date of birth. I can choose a date and save it in the database. But when I return to the registration screen of this client this field (type="date"
) is not displaying the value saved in the database. Can anyone help me understand what is wrong with my code ?
<? $dtnascimento = '';
if($rst[0]['datanascimento'] != '') {
$dtnascimento = $rst[0]['datanascimento'];
$dtnascimento = date_format(date_create($dtnascimento),"d/m/Y");
} ?>
<label>Data de Nascimento</label>
<input type="date" id="datansc" name="datansc" value="<? echo $dtnascimento ;?>"/>
When you give the $dtnascimento die it returns the date as?
– Caique Romero
the customer’s date of birth in the format I chose
"d/m/Y"
15/02/1975– goldenleticia