Next input - do this

is it possible in php to wait for the next thing in an input box to be submited and then run some code with it. for example 1 + $next_input; thanks

Depending on exactly what you’re trying to accomplish, you can store data in a session variable, or use AJAX (it’s easiest to use a javascript library, rather than raw javascript code) to communicate from the user’s browser to the server.

Can you elaborate on what you’re trying to do?

im building a calculator with a running total. you enter the number into the input then press say the ‘+’ button and it will add that to the current total. however the code messes up when i switch from adding to then subtracting values. i cant seem to get a the code working.

Javascript would probably be a more appropriate choice, since it sounds like there’s not much of a reason to go back to the server for every calculation.