Refresh page after action

2

I have a function to change records in the database and use a modal to show success message or change error.

The issue is that I can delete, but I would like to have the page automatically refreshed after this function.

elseif(isset($_GET['Acao']) && $_GET['Acao'] == 'Alterar') {
   $Id = $_GET['Id'];
     $sql = mysql_query("UPDATE vendas SET Mostrar = '0' WHERE Id = '$Id' ");

     if ($sql){
       echo '<script>modal({type: "inverted", title: "INFORMAÇÃO!", text: "Aterado com Sucesso!"});
       </script>';}
      else {  
        echo '<script>modal({type: "error", title: "Ops!", text: "Erro ao Alterar!"});</script>';             
}
<table class="lista-clientes" width="100%""> 
<tbody>     
    <tr>
        <td align="center"></td>
    <td> 

    <select class="select_styled">
        <option value="">'.$dados['Pessoa'].' </option>
        <option value="">'.$dados['Venda'].'</option>
    </select>
    <center>
        <a href="?Id='.$dados['Id'].'&Acao=Alterar" class="btn btn-follow" style="text-decoration:none;">
            <span>Remover!</span>
        </a>
    </center>
    </td>
    </tr>
 </tbody>
</table> 
    
asked by anonymous 26.12.2016 / 23:39

3 answers

3

You can use JavaScript and php to reload the page.

Javascript

location.reload();

PHP

header('Refresh:0');
    
26.12.2016 / 23:50
0

From what I understand, what you need is this:

<a href="#" onclick="window.opener.location.href='home.php'; window.close()"><input class="btn btn-warning" type="submit" value="Fechar Janela"></a>

Put this code on the confirmation page and this link to the user clicking it updates the page you set in "window.opener.location.href='home.php'

    
26.12.2016 / 23:59
0

To reload a page via javascript you can use one of the following options:

Javascript 1.0

window.location.href = window.location.pathname + "pagina";
  

Create page history entry

Javascript 1.1

window.location.replace(window.location.pathname + "pagina");
  

Do not create page history entry

Javascript 1.2

window.location.reload();
  

Reload cache page

window.location.reload(false);
  

Reload cache page

window.location.reload(true);
  

Reload server page (new GET force)

    
28.07.2017 / 15:33