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.

Link to comment
Share on other sites

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...

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.