I do the following filter at the value sent 3.5
$prd_PorcentajeRF = filter_input(INPUT_POST, 'prd_PorcentajeRF',
FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
And after the filter shows 4 or 35, how can I fix it? Thanks
I do the following filter at the value sent 3.5
$prd_PorcentajeRF = filter_input(INPUT_POST, 'prd_PorcentajeRF',
FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
And after the filter shows 4 or 35, how can I fix it? Thanks
You can use the php function number_format to convert the number with points to decimals.
example:
$numero = 3.5;
$numero_coma = number_format($numero);
exit:
3,5
The filter is correct, the problem was in the database where the data type was as Decimal 10,0, change it to 12,2 and the value is already displayed correctly. Thanks for your comments.