Hi
I am new to PHP and I have a form where the person has to manually enter the price for a item. For some reason my payment processor wont accept decimal points!! Example if a item is 1200 or 1200.00 and that is submitted then it appears as 12.00 at the processors end. To have the value 1200.00 appear on my payment processor someone would have to type 120000!
Also if someone types in 1200 is there a way I can have two extra 0's added?
Removing Decimal Point
Moderator: General Moderators
Re: Removing Decimal Point
This one is pretty cool:
http://us2.php.net/manual/en/function.money-format.php
http://us2.php.net/manual/en/function.money-format.php
Re: Removing Decimal Point
Unfortunately thats no good as I need to remove the decimal point.
Re: Removing Decimal Point
Multiply the number by 100?JimmyNo wrote:Also if someone types in 1200 is there a way I can have two extra 0's added?
Re: Removing Decimal Point
Maybe if we had a look at your "payment processor" coude we would be more helpful 
There are 10 types of people in this world, those who understand binary and those who don't
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: Removing Decimal Point
Code: Select all
number_format()Re: Removing Decimal Point
Code: Select all
$new_string = preg_replace("/[^a-zA-Z0-9s]/", "", $string);Er...... Bloody hell yes! That would sort out my problem including the decimal point! Cheers Mate! I couldn't see the forest through the trees! The simple solutions wins the prize!Multiply the number by 100?