My app. uses a two-page design where the first page poses a question and the second page provides an answer and scoring. It uses hidden fields and POSTS to Session variables to increment counters for the number of questions taken and answered correctly.
It works pretty well except when back navigating using the BACK button. This UI action causes the counters to increment and mess up the scoring.
The problem appears to be the snippet below which increments the variable whenever the page is loaded.
Is there a way to write this so that the variable only gets incremented when the FORM is submitted - and not each time the page gets loaded?
<input name="total incr" type="hidden" value=" <?php $_SESSION['total']++;?> ">