I have a movie table on my site that you have the option to edit and delete. I'm having trouble deleting the movie from my table. What I want to do is: When you click Delete, it moves the row to another table of the same type, doing backup. After it moves, delete the row from the current table.
What I can not do is pass the field id on the link. When I click the button to "delete" the table, it does not pass the desired value, passing only the value 2.
Follow my code:
Boot
<a href="painel_adm_deletefilme.php?idFilme='.$dados['idFilme'].'"><input class="btn btn-danger" name="excluirFilme" value="Sim" class="btn btn-danger"></input></a>
panel_adm_deletefilme
<?php
session_start (); include_once 'connectBanco.php';
$id = $_GET["idFilme"];
$envia = "INSERT INTO filmesDelet (idFilme, filme, descricao, genero, anoLancamento, faixaEtaria, trailer)
SELECT idFilme, filme, descricao, genero, anoLancamento, faixaEtaria, trailer
from filmes where idFilme = '$id'";
$insere_bd = $conecta->prepare($envia);
if($insere_bd->execute()){
echo 'sucesso';
}else{
echo 'failed';
}
? >
The code returns no error. It goes right into the success if, not being passed the table the desired line. Whenever I click to "delete" it passes the value id 2.