I can not remove an item from the database

3

I'm trying to remove an item from the database, but it is not removing it.

        <form action="removelicita.php" method="post">
            <input type="hidden" name="id" value="<?=$licitacao['id']?>">
            <button type="button" class="btn btn-danger">Remover</button>
        </form>

Above the code snippet where I call the delete action. Below the exclusion code:

<?php

require_once("conexao.php");

$id = $_POST["id"];

$query = "delete from insereLicitacao where id = $id";

if(mysqli_query($conexao,$query)){
    header("Location: listalicitacao.php");
    die();
} else {
    echo "Erro ao remover licitação";
}
    
asked by anonymous 11.09.2017 / 15:29

1 answer

4

Change the type attribute of the button tag to submit the form

<button type="submit" class="btn btn-danger">Remover</button>

Reference:

link

    
11.09.2017 / 15:37