Forum


Calc Builder Support

Calc Builder support
Forums
Public write access is disabled. Please login

How can I make calcbuilder ignore commas 31.07.2012 21:51

My calculators have been working great but I just noticed one major flaw. If the user types in a comma in the number (for example 1,000,000), it's recognizing that number as zero. How can I fix that?

Re: How can I make calcbuilder ignore commas 31.07.2012 22:47

Yes, you should get rid of them before executing operations, because numbers with commas are not valid numbers and that's why they are handled as 0 . Before going to the operations, parse user input this way at the beginning of your code:

$input1=str_replace(",","",$input1);


This will clean the $input1 number from the comma sign and can be used as a number afterwards.

Hope this helps,
Moonsoft Team
www.moonsoft.es
Are you satisfied with our products/services/support?
Please help us to keep improving, add a review at  joomla extensions site and  magento connect

Our clients' feedback