I have a date input to register dates on a form. Dates are recorded and displayed correctly. The problem comes when I want to edit the saved date, I need to show me the saved date in order to make changes.
This is my code for the date input :
<p>
<label>Fecha:</label>
<p type="Fecha:">
<input type="date" name="fecha" step="1" value="<?php echo date("Y-m-d");?>" autocomplete="off" required value="<?php echo $fecha; ?>" />
<?php echo form_error("fecha","<span class='help-block'>","</span>") ?>
</p>
</p>
You are using double value attributes in the input. Please remove one and put values in the condition.
<p><label>Fecha:</label> <p type="Fecha:"><input type="date" name="fecha" step="1" value="<?php if(!empty($fecha)){ echo $fecha; } else { echo date("Y-m-d"); } ?>" autocomplete="off" required /><?php echo form_error("fecha","<span class='help-block'>","</span>") ?> </p></p>