thanks
Adding up values with $ signs
Moderator: General Moderators
- Templeton Peck
- Forum Commoner
- Posts: 45
- Joined: Sun May 11, 2003 7:51 pm
Adding up values with $ signs
I have a form with text fields where $ amounts get entered.. like say $5 but when it hits the target php file to total and display the amount. If there are any "$" signs used in the text field on the form it comes out blank in the target php file and doesn't total it. Anyway I can fix this so it'll just ignore the $ sign and add the value beside it?
thanks
thanks
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
If the amounts are always going to be in dollars then just put the dollar sign in the form next to the text field and just take numerical input in the text field. You can also strip the $ sign out before doing the calculations:
and put it back when you're finished.
Mac
Code: Select all
$no_dollar = str_replace('$', '', $with_dollar);Mac