Re: Removing a comma from a form field
| From: | Eric Golpe | Date: | Sun, 16 Feb 2003 21:08:45 +0000 |
| Subject: | Re: Removing a comma from a form field | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-135844@lists.php.net to get a copy of this message | ||
Just a thought.. If it is only a comma, and it is a form field, why do this
on the server side,
Perhaps a javascript onsubmit function that traps the comma (indexOf/charAt)
and then shift the
values over with substring. Since you know it's USD then you could do
value.length-3 or something similar.
You can also use the sprintf() function of php to keep the decimal places.
Have fun!
"Ben C ." <benc@cox.net> wrote in message
news:20030213181352.XHA14657.fed1mtao08.cox.net@smtp.west.cox.net...
> I'm trying to update a field which contains a $USD figure. But when I
update it as 200,000 it become 200. I need to take out the comma. Is using
ereg_replace function the best way of doing so? What do you think.
>
> Thanks,
>
> Ben
>