Jump to content

Currency Format in Form Text Field


FeralReason

Recommended Posts

Note: The function money_format() is only defined if the system has strfmon capabilities. For example, Windows does not, so money_format() is undefined in Windows.

Read the comments on the same page though, looks like someone posted a fully php based version of it doing the same thing for windows platforms.

It does however not have a function check build in, so you might want to add that yourself unless you're sure your script will ALWAYS be run on a windows server since the 'native function' will doubtlessly be many times faster.

Alexia - you are correct on both points. I did try this code and although it seems to correctly format the floating point value in the form's textbox I was then unable to edit / save the value -- so I am not sure that the money_format() function was intended to be used inside a form's text box. (If anyone is using this in a form, I would love to see how you are doing it !) I am fairly new to PHP/HTML but in other environments, setting how values are formatted (currency,etc) at the presentation layer (in forms) has always seemed fairly straightforward. I must be missing something...

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.