如何在使用带有值的按钮重定向到另一页时删除确认表单重新提交

问题描述:

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!!

美好的一天,正如标题所说,我该怎么做? 我想要做的是在第1页,我循环所有数据,每个数据都有一个具有特定ID值的按钮,然后该按钮重定向到公共页面2,然后我使用第2页上的id显示 他们的整个数据,但问题是,当我刷新时,会出现对话框。 p>

我尝试使用会话,但问题是当多个标签访问它时。 p> \ n

我还没有真正尝试过PRG,但根据我的理解,它用于使用另一个页面向服务器发送更改,然后重定向到上一页,在刷新时阻止对话。 我想过使用它,但我不知道如何从第1.5页到第2页发送所获取的数据 p>

我真的很感激这个解决方案,或者如果有人 可以把我联系到类似的问题。 也许这是一个重复的问题,但我找不到我的问题的术语。 干杯!! p> div>

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.