I'm trying to write a form to the database, in that form there's a date field that contains dd/mm/aaaa
mask. To write to the bank I need to convert that date to aaaa-mm-dd
, until then I got str_replace
, the problem is that when I write this variable in the bank it returns me an error and does not record anything in the bank. Follow me code:
<form action="envia.php" method="post" enctype="multipart/form-data">
<div class="form-row">
<div class="form-group col-md-6">
<label class=""><b>Sistema</b></label>
<select name="sistema" class="form-control" required/>
<option selected>Escolha o sistema</option>
<option value="ATPH">ATPH </option>
<option value="DPPH">DPPH Pagamento</option>
<option value="EFPH">EFPH </option>
<option value="SCPH">SCPH</option>
<option value="GEPH">GEPH</option>
<option value="BICLI">BIPH</option>
<option value="BISER">BIPH</option>
</select>
</div>
<div class="form-group col-md-6">
<label class=""><b>Data</b></label>
<input type="text" name="data" class="form-control" maxlength="10" onkeypress="mascaraData(this)" placeholder="Digite a data da Revisão" required/>
</div>
<div class="form-group col-md-6">
<label class=""><b>Versão</b></label>
<input type="text" name="versao" class="form-control" placeholder="Digite a Versão" required/>
</div>
<div class="form-group col-md-6">
<label class=""><b>Revisão</b></label>
<input type="text" name="revisao" class="form-control" placeholder="Digite a Revisão" required/>
</div>
<div class="form-group col-md-12">
<label class=""><b>Arquivo</b></label>
<input type="file" name="arquivo" class="form-control" required/>
</div>
<div class="form-group col-sm-2">
<div class="">
<button type="submit" class="btn btn-primary upload">Enviar</button>
</div>
</div>
</div>
</form>