Good day, as the title says, how can I do that? What I'm trying to do is that on page 1, I looped all data with each having a button that has value of their specific id, then that button redirects to a common page 2, then I use that id on page 2 to display their whole data, but the problem is that when I refresh, the dialog appears.
I tried using session, but the problem is that when multiple tabs are accessing it.
I haven't really tried PRG, but on my understanding, it is used to send changes to the server using another page, then redirect to the previous page, preventing the dialog when refreshing. I thought of using it, but I don't know how to send the fetched data from page 1.5 to page 2
I'd be really grateful for a solution to this, or if someone can link me to similar problems. Maybe this is a duplicate question, but I just can't find the term for my problem. Cheers!!
If you control both pages, change the redirect mechanism on page 1 to GET by simply redirecting to a URL with a parameter appended to the address: target.php?id=42
.
If you control only page 2, you may convert a POST request with an id
to a GET request:
if (isset($_POST['id']))
{
header('Location: target.php?id=' . $_POST['id']);
exit;
}
More on GET vs POST here, as well as a couple of other answers.