I cannot remove an item from the database

Asked

Viewed 44 times

3

I’m trying to remove an item from the database, but I’m 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 exclusion 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";
}
  • Gives any error ? Or only shows "error while removing bidding" ?

  • Yeah, here’s the thing, it doesn’t make a mistake and it doesn’t show the message

1 answer

4


  • I was already commenting on this... it will solve the problem :D

  • Good to know if you can read this link https://answall.com/help/someone-answers to find out how to proceed after your question has been answered ;)

  • Thank you very much!! I will read now

  • Why use button and not input?

  • There is discussion on https://answall.com/questions/12285/devo-usar-input-type-submit-ou-button-type-submit-nos-formul%C3%A1rios

Browser other questions tagged

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