Actually I have an idea that this is the problem, ignore the rest of my ramblings:
The variable total is being printed in each form because that is exactly what the script is telling it to do... so.
I'm guessing that each form item needs to have a unique name, but I'm not sure how to make a script to calculate the form values if there's potentially unlimited element names that the values are coming from...
And wouldn't the total variable have to be unique for each form also so that it only prints in the correct place?
The guy above probably already answered this question but I'm too inexperienced/dense to see it
I may have gone about this completely the wrong way... or is my code so far salvageable?