If I wanted to validate that a user entered a monetary format (US only), what would I need to do?
I have started the code below, but this only checks if the data input are digits. As soon as someone puts a comma (ie. 13,000), it doesn't match.
Optionally, I'd need the code to be halfway intelligent; ie. if a user enters '1233', translate as 1,233.00 and not something like 12.33.
If you can point me to any ready-made code, great - I'm betting someone has tackled this already. I'll also keep looking.
THANKS!
if (!preg_match("/[^0-9]/", $_POST['salary'])) {
echo "A match was found.";
} else {
echo "A match was not found.";
}