Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2008
    Posts
    50
    Thanks
    18
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    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

  • Users who have thanked oesxyl for this post:

    Inersha (08-08-2008)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •