Cflax Posted April 30, 2011 Share Posted April 30, 2011 i have a form that has a price field, but if anything other than a decimal (0.00) a zero is entered into the database. There is the problem of people trying to add a dollar sign before their amount. What is the best way to validate a price amount to be entered into the database. The column in the database type is decimal(6,2). Any suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/235158-text-field-for-dollar-amounts/ Share on other sites More sharing options...
efficacious Posted April 30, 2011 Share Posted April 30, 2011 write a script to check for and remove $ sign, either with javascript or with php after taking the input or add a $ sign before the textfield as static text on the site so the user doesn't feel it neccesary to include the $ sign Quote Link to comment https://forums.phpfreaks.com/topic/235158-text-field-for-dollar-amounts/#findComment-1208547 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.