I'm doing a PHP and MySQL course on Alura and got to the part where we built the code that removes the product from the database.
The page that calls the delete function must redirect the user back to the produto-lista.php
page and the course instructor suggested the following code:
<?php
include("cabecalho.php");
include("conecta.php");
include("banco-produto.php");
$id = $_GET['id'];
removeProduto($conexao, $id);
header["location: produto-lista.php"];
?>
It turns out that this way the product is yes being removed, but the header location
is generating me the following error:
Notice: Use of undefined constant header - assumed 'header' in C: \ xampp \ htdocs \ store \ remove-product.php on line 8
Warning: Illegal string offset 'location: product-list.php' in C: \ xampp \ htdocs \ store \ remove-product.php on line 8
I'm using Xamp for Windows.