Since I wanted to use the buttons, I tried the following fix ...
The original code looked like this:
//Check if 'previous' button has been pressed
if ($previous)
{
if ($appno > 1)
{
$appno--;
The new code looks like this:
//Check if 'previous' button has been pressed
if ($previous)
{
if ($appno > 1 && !$next) //To fix a weird problem when user presses 'next' button
{
$appno--;
This way, even if the script goes into the IF statement when it shouldn't (i.e. when the 'Next' button is pressed), the extra check means that it won't execute anything within the boundaries of the IF statement.
The strange thing is that all the other buttons, including 'Previous' are detected and work properly. The only problem is with the 'Next' button.
😕
Anyway, this method works fine.