0
I have a page where the form is with an action that sends the form information to another page.
I would like a confirmation (or negation) message to be displayed after the registration has been entered and, after clicking the OK button, a redirection to the original page.
The form page looks like this:
<form id="frmCad" name="frmCad" method="post" action="../inc/processa.php?modo=incluir&fnc=<?php echo $fnc; ?>&ans=<?php echo $linha; ?>">
The proxessa.php file looks like this:
$fnc = $_GET['fnc'];
$linha = $_GET['ans'];
if($modo == "incluir"){
$sql = "INSERT INTO `pe_premorc` (etc)
$linhafec = mysqli_affected_rows($conexao);
if($linhafec == 1){
echo "<script>alert('Premissa incluída com sucesso');</script>";
header('Location: ../views/premorc.php?fnc=$fnc&ans=$linha');
} else {
echo "<script>alert('Ocorreu um erro. A premissa não foi incluída');</script>";
header('Location: ../views/premorc.php?fnc=$fnc&ans=$linha');
}
But I’m not getting the desired effect. Either display the message and stay on the same page, or neither display the message and redirect with the wrong parameters, type http://localhost/final/views/premorc.php? fnc=$fnc&ans=$line
I come to say that I tested the first one and, this one worked, it worked.
– user193931