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)