Clear URL Parameters after include

Asked

Viewed 1,421 times

0

When I pass parameters in the URL to a particular file through a GET, and this file makes the necessary changes, it has a include to return the home page of the action performed.

When you return to the page, the information passed as parameters is still in the URL (example: site.com/página.php?id=31). How do I when returning it update and stay only the real page (site.com/pagina.php)?

File with include ( goes to the header, makes the changes and returns to where it was in the templates/startup folder.php):

<?php
$excluir=1;
include("includes/cabecalho.php");

if(isset($excluiu)){

    if($excluiu==1 || $excluiu==0){
        include("templates/inicio.php");
    }else{
        echo "<script>alert('O Sistema apresentou algum erro, fale com o administrador!');</script>";
    }

}else{
    echo "<script>alert('O sistema apresentou algum erro, fale com o administrador!');</script>";
}

?>

  • How are you doing the include? It would be nice to explain the question better because you say you have one include to return to the home page, which doesn’t make much sense. What you call "return"?

  • Rodrigo, a little code with the relevant parts may make the question clearer

1 answer

-1

For a redirect you better switch.

include("templates/inicio.php")

for

header('Location: templates/inicio.php'); ou 
header('Location: http://site.com/pagina.php'); //Ai já redireciona.

more if it is not case of "Redirect" as described in question will not solve the problem.

  • Hi, Luiz, welcome to [pt.so]. Can you explain why your solution solves the problem? The [Swer] guide has more tips and can [Dit] the answer whenever you want.

  • Luiz’s solution causes other errors to occur. It doesn’t work. However, I don’t think I need more. Anything I report here again.

  • @Rodrigosegatto if you have found a solution to the problem, post it as an answer.

  • I couldn’t find it. I want to leave the URL and do it another way. Anyway, thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.