How do I make a data entry of 5500 auto display as 5,500.00

3 posts by 2 authors in: Forums > CMS Builder
Last Post: March 29, 2011   (RSS)

By Codee - March 29, 2011

Inside CMSB in a products section, with regards to a price field: the client would like to enter just the digits into the database, but have the display use a numeric format with a comma and 2 decimal places.

for example, they enter 3587 into the price field...and the end user would see 3,587.00 (the $ sign can obviously be added with html).

or they enter 45667 into the price field and the end user sees 45,667.00 ?

Thanks!

Re: [equinox69] How do I make a data entry of 5500 auto display as 5,500.00

By Damon - March 29, 2011

Hi,

Try the number_format function:
<?php
$number = 2300;
$formatted = number_format($number);
?>

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/