The submit button only updates the DB after pressing F5

0

I am creating a browser RPG game where the player registers first and race and then is redirected to a page where he chooses the class. When clicking on the submit button, the breed and race statuses are saved in the DB and the player should be redirected then the problem is that when I click on register the race, the page refreshes but the user data is not sent to BD, only when I press F5 is that the data is sent and I'm redirected to the next page. Does anyone know why this happens?

    if ($numPers == 1) {
        header("location:cadastrarclasse.php");
    }elseif($numPers > 1){
        header("location:taverna.php");
    }
    else{

This code is above the head. The else is in case the user has not yet registered anything, so he stays on the race register page.

    
asked by anonymous 27.03.2018 / 07:28

1 answer

0

Header does not transfer the $ _POST or $ _GET data between PHP pages, it only defines the HTTP header and redirects the user. link

You should use an include , which transfers the execution stream from your Script to another file and returns after it.

if ($numPers == 1) {
   include "cadastrarclasse.php";
} else if($numPers > 1) {
   include "taverna.php";
}

Similar problem you should be facing here:

link

    
27.03.2018 / 15:12