I need to add a field where someone can add a fraction, like 1/5 or 2/15. Later, those fields will be added up, and I'll need to give the sum total as a decimal.
What's the correct way to make the field so I can add up the figures in PHP in decimal format? Should the field be of type varchar to accommodate the fraction, then I'll look for a PHP script on adding fractions and converting to decimal?
my suggestion is if you really require actual fractions to be accepted, that you at least validate and process them on input (regardless of whether the form field on the web page is a text box, dropdown, or whatever) and then store them as decimal values (not float)
So they need to be decimal values in order to add them together? I was thinking that I should do something like:
yup, i mentioned dropdowns, that works
OK, I'll keep it simple and go the drop-down route.