Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-07-2008, 11:39 PM   PM User | #1
Inersha
New Coder

 
Join Date: Jun 2008
Posts: 50
Thanks: 18
Thanked 0 Times in 0 Posts
Inersha is on a distinguished road
Form Not Processing Decimal Number

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...

PHP Code:
$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.
Inersha is offline   Reply With Quote
Old 08-08-2008, 12:38 AM   PM User | #2
oesxyl
Master Coder


 
Join Date: Dec 2007
Posts: 6,682
Thanks: 436
Thanked 890 Times in 879 Posts
oesxyl is a jewel in the roughoesxyl is a jewel in the roughoesxyl is a jewel in the rough
Quote:
Originally Posted by Inersha View Post
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...

PHP Code:
$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.
PHP Code:
$string preg_replace("/[^\d.]/",'',$stringa); 
be aware that will allow to have multiple '.' in $stringa.

regards
oesxyl is offline   Reply With Quote
Users who have thanked oesxyl for this post:
Inersha (08-08-2008)
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:11 PM.


Advertisement
Log in to turn off these ads.