I have this code:
<?php
if ($result = $mysqli->query("SELECT * FROM usuario ORDER BY id"))
{
if ($result->num_rows > 0)
{
echo "<table border='1' cellpadding='5' cellspacing=0 style=border-collapse: collapse bordercolor='#41c88c'>";
// definir cabeçalhos de tabela
echo "<tr> <th>ID</th> <th>Nome</th> <th>Email</th></tr>";
while ($row = $result->fetch_object())
{
// cria uma linha para cada registro
echo "<tr>";
echo "<td>" . $row->id . "</td>";
echo "<td>" . $row->nome . "</td>";
echo "<td>" . $row->email . "</td>";
echo "<td><a href='edit_usu.php?id=" . $row->id . "'>Editar</a></td>";
echo "<td><a href='delete.php?id=" . $row->id . "'>Deletar</a></td>";
echo "</tr>";
}
echo "</table>";
}
}
?>
And I need a text box to ask first if I really want to delete the data, what is the best way to do this? grateful.
I tried to use it this way:
<script type="text/JavaScript">
function delete(){
var agree=confirm("deseja deletar os dados??");
if (agree)
return true ;
else
return false ;
}
</script>
But I do not know how to use the variable $ confirm