...

View Full Version : Form Not Processing Decimal Number



Inersha
08-08-2008, 12:39 AM
I have a form and script that works with numbers that are entered, but it doesn't seem to be able to work with decimal numbers.

Im thinking it could be due to this...


$string = preg_replace("/[^0-9]",'', $stringa);

If this is the problem, how can I make it so that the form can work with decimals and not turn each number entered into an integer?

Thanks in advance.

oesxyl
08-08-2008, 01:38 AM
I have a form and script that works with numbers that are entered, but it doesn't seem to be able to work with decimal numbers.

Im thinking it could be due to this...


$string = preg_replace("/[^0-9]",'', $stringa);

If this is the problem, how can I make it so that the form can work with decimals and not turn each number entered into an integer?

Thanks in advance.



$string = preg_replace("/[^\d.]/",'',$stringa);

be aware that will allow to have multiple '.' in $stringa.

regards



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum