I have an HTML form where the user can type in any number:5, 8, 4.2, 5.8, anything in terms of numbers (integers or doubles).
However, I was wondering is it possible to have my php script round some of the numbers when entered into the html form, for example when a user enters 4.2, the php script should be able to round it to 4 or if it's 5.8, the php script should round it to 6.
Before I start manipulating the data in terms of calculations?
Furthermore, what is the best way to format the decimal numbers and echo them out to the screen before manipulating them and after, currently I have it set so that if a user enters 5.8 it will just echo 5.8; however, i was wondering if there are better methods or should I use printf or sprinf to somehow format the information and print out the results after I am done with my calculations.
, thanks.