0
I have a form where I compare two dates ( dt_ocorrencia e dt_prev_entrega )
and I bring the result, so far everything ok. | However I would like to type in one of the fields.
follows code.
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">Dt Ocorrência:</label>
<div class="col-sm-10">
<input type="date" required name="dt_ocorrencia" class="form-control" value="<?php echo $data_inicial = date('Y-m-d'); ?>">
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">Prev. de Entrega:</label>
<div class="col-sm-10">
<input type="date" required name="dt_prev_entrega" class="form-control" value="<?php echo $data_final = date('2016-08-12'); ?>">
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">SLA:</label>
<div class="col-sm-10">
<input type="text" required name="sla" Onclick="calc()" class="form-control" value="<?php
// Calcula a diferença em segundos entre as datas
$diferenca = strtotime($data_final) - strtotime($data_inicial);
//Calcula a diferença em dias
$dias = floor($diferenca / (60 * 60 * 24));
echo "$dias";
?>">