PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
You should find some way of validating it on the server side agian but on the client side you can format the dollar value in your javascript by.
doesn't deal with $ or £ or € or any other money symbol but deals with number formating.
Something to remember: Don't prevent the user from entering a $. I've seen too many sites that do something like:
Do not enter a $, or don't enter - when entering your credit card. You're the programmer. Simply remove these common characters, and then validate the result from there.
So, if someone enters ` $29.95 `, which has an extra space at the beginning and end, and a dollar sign, you can easily strip out the extra spaces and the dollar sign. Then, validate the result, which would be 29.95. That's much more intelligent than simply outputting "Error!"