1
I have a form field in which I am using the maskmoney
, but when the number entered enters the thousand, the number_format
returns only the first four decimal places.
The call of maskmoney
:
$(function(){
$("#Cultsal").maskMoney({symbol:'R$ ',
showSymbol:true, thousands:'.', decimal:',', symbolStay: true});
The field input
:
<label for="Cultsal">Digite o valor</label>
<input id="Cultsal" name="Tultsal" type="text" size="10">
php:
echo "O valor digitado foi de R$ ". number_format($ultsalbase, 2, ",", ".");
However, when the output is miles, php returns only the first four digits. For example, if I enter 1000, maskmoney presents 1,000.00, but php returns 10.00. Up to 100 works normal, like, I enter 100, the maskmoney
shows 100.00 and php returns 100.00. Only gives prolema when goes to thousand.
There is a solution, or I’ll have to use another mask?
Edit: I need the number_format
because when I use the value in a function with another variable, it doesn’t "inherit" the formatting correctly (it doesn’t include the ".00", sometimes it puts .000 etc). For example:
if ($tiposal=="hora") {
$rem = ultsalbase * $multipl;
}
Even if I put the number_format
only in the other variable ($rem
in case) it gives the same error.
Can help number formatting
– rray