I would avoid using the onchange event to submit. This will fire alter every keystroke which would be very annoying if it is submitting on every key press. onBlur may be a better one to use. So the calculation is triggered when the user exits the box.
If you do use a PHP solution you can return the values submitted back to the input box via the value="" entry in the tag.
Javascript from the onchange event would be my choice. If you are not up on javascript try the prototype library. It makes things much easier and deals with browser differences.