|
Posted by nostabo on 12/22/06 23:52
Thank you, but this simply adds another decimal place to the truncated
value.
1.000 instead of 1.00
Rick
"Ric" <antispam@randometry.com> wrote in message
news:emhntf$dk$1@online.de...
> nostabo schrieb:
> > Hi all,
> >
> > I have been trying to display numbers (actually money amounts) on an
HTML
> > form in text type input boxes and then use the posted values in
calculations
> > using PHP. The problem is that I can accept inputted values from a text
box
> > when entered in the 1000 or 1000.00, but when a users adds a comma the
value
> > (for example 1,000.00) the value is displayed as 1.0 by the
number_format
> > function (see my code below)
> >
> > <input type='text' id='software' name='software' value='<?php print
> > number_format($_POST['software'], 2);?>' >
>
> this shoudl do it:
>
> number_format($_POST['software'], 3)
>
>
> >
> > But, this also affects any reposting of the form since the posted var
takes
> > on the value as displayed in the text box.
> >
> > Is there a way around this? This bad value eventually shows up in the
> > "posted" var if the form is resent after the user makes a change, so it
can
> > screw up my calculations.
> >
> > TIA,
> >
> > Rick
> >
> >
Navigation:
[Reply to this message]
|