This is such a simple question that I'm afraid I'm missing something basic, so feel free to shame me, but I'm stumped.
My goal: make a "continue" button that reloads the same page, but with an incremented ?Page= parameter that's visible to GET.
My current approach: define the new URL that should be loaded (this bit works)
$_SESSION['NextPage'] = $_SESSION['Page']+1;
$_SESSION['NewURL'] = $_SESSION['CurrentFile'] . '?Page=' . $_SESSION['NextPage'];
// N.B: $_SESSION['CurrentFile'] just specifies the URL of the current page.
// Note also that there should ALWAYS be a ?Page= parameter in the URL, even if it evaluates to NaN or something weird.
Then, later on, a function is called that runs this code and creates a submit button. The button is there, as expected, but it doesn't WORK as expected: code & details below.
echo "<tr><td><form action='" . $_SESSION['NewURL'] . "' method='GET'> <input type='submit' value='Continue'></form> </td></tr>";
The problem: When the form submits, it doesn't append any ?Page=
parameters to the URL, either in Chrome or Safari. Is this because the Page parameter isn't specified inside this form?? If so, there must be a way around that, right? $_SESSION['NextPage']
is a session variable, for crying out loud! Not to mention that when I echo $_SESSION['NewURL']
inside the function, the info is accessible there, ?Page=2
and all. It's just not pushed to the URL. Unfortunately, the page is set up to display different content based on the value of $_GET['Page']
, and now there's nothing there to control that process.
If I've just made a syntax error or something I'll be embarrassed but relieved. I just can't find it, and don't know where else to turn. Thanks!