2

I have 3 pages.

-page1.php sends data through a form with post action

-page2.php recieves data from page1.php. In page2.php there is a link to page3.php

-page3.php does some staff.

When i click to go back from page3 to page2 occures

Confirm Form Resubmission

ERR_CACHE_MISS

I understand the reason of this behaviour. When I take data from page1 to page2 I store some of them in session so i don't need always to use submit. How can i check if submit was done in order to continue normally if no submit was used?

Here is some code of page2:

<?php
if (session_status() == PHP_SESSION_NONE) {
    session_start();
}

global $dbcnx;

if (isset($_POST['submit']))//if i submit i store in session
{
    $_SESSION['team_name'] = $_POST['teams'];
    echo $_SESSION['team_name'];
}

else //do nothing
{}

//conitnue code normally
.
.
.

That was my last try. Any response will be helpfull. Thanks in advance!

Dia
  • 27
  • 6

2 Answers2

1

The usual way to prevent that is to redirect to a page with no post data, click the link to see more info on How to make a redirect in PHP?

Community
  • 1
  • 1
Korri
  • 657
  • 7
  • 22
0

The answer is that you should redirect to a specific page using php.that is done with header().
this should be a help:

header("Location: http://www.something.com/any/thing.php")   //the page can be anything

Of course, if you're using xampp or wamp or whatever server, use it this way:

header("Location: http://localhost/any/thing.php")   //the page can be anything
marc_s
  • 455
  • 1
  • 4
  • 15