I have a form where I compare two dates ( dt_ocorrencia e dt_prev_entrega )
and I bring the result, so everything is ok. But I would like to type in one of the fields to update the result.
code follows.
</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";
?>">