How to insert a variable value in the PHP Header?

Asked

Viewed 188 times

0

My intention is that when you delete a bill, it goes back to the index page of notes referring to that work.

Code:

{
    $id = $_POST['id'];
    $ok = $_GET['obra'];
    //Delete do banco:
    $pdo = Banco::conectar();
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $sql = "DELETE FROM notas where id = ?";
    $q = $pdo->prepare($sql);
    $q->execute(array($id));
    Banco::desconectar();
    header('Location: index01.php?obra=' . $ok); 
}
  • 1

    The way to concatenate the values is correct. Is there a problem executing it?

  • Although I’m testing the variable and it’s showing value, this header is not, it goes back to the page without value! so I don’t know exactly what’s going on!

No answers

Browser other questions tagged

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