0
I have a field in the html
text type that has a coin mask.
I have to save this value in a field of the kind double
in the database, but I’m having trouble converting, where the value that would be after the comma is deleted after the conversion.
html code:
<div class="form-group ">
<label class="control-label " for="adiantamento">
Adiantamento
</label>
<div class="input-group">
<div class="input-group-addon">
R$
</div>
<input class="form-control" type="text" id="adiantamento" name="adiantamento" onKeyPress="return(MascaraMoeda(this,'.',',',event))"/>
</div>
</div>
PHP code (I replace the comma with the dot and try to make the conversion to double)
$adiantamento=str_replace(',','.',$_POST['adiantamento']);
$adiantamento_C=(double)$adiantamento;
Form Screen