Running total in PHP Code (online php coding)

Every time you run your PHP code, it’s run from scratch on the server, and when the program ends all values are lost. The only value that will be present is $bonus (because you get it from the form post value), and $buzz because you define it in the code. $runningtotal will be set to the same as $total, because as soon as your code ends, all the variables are lost and $runningtotal, like any undefined variable, will start with a value of zero.

If you want to keep a running total like that, you’ll either have to put it in a database or use session variables as @spaceshiptrooper said above.