Quiero que salga un boton para poder borrar el contenido de un <td> desde la base de datos, no me da error pero el boton no aparece.
<html>
<head>
<meta charset="UTF-9">
<style>
table {
width: 100%;
border-collapse: collapse;
}
table, th {
border: 1px solid black;
padding: 5px;
}
td {
border: 1px solid black;
padding: 5px;
}
th {
background-color: #4CAF50;
color: white;
text-align: left;
}
</style>
<?php
if (isset($_POST['borrar_archivo'])) { require("connect_db2.php");
if (mysqli_query($link, "DELETE FROM examenes WHERE asignatura = '{$_POST['archivo_id']}'")) { echo "<p>Archivo borrado correctamente!</p>";
} else {
echo "Error al conectar a base de datos";
}
}
?>
</head>
<body bgcolor="#8DC6FF">
<?php
require("connect_db2.php");
$borrar_html =
"<form action='' method='post'>
<input type='hidden' name='archivo_id' value='{$resultados['id']}'/>
<button type='submit' name='borrar_archivo'>Borrar</button>
</form>";
function mostrarDatos($resultados) {
if($resultados !=NULL){
echo
"<tr>
<td>{$resultados['asignatura']}</td>
<td>{$resultados['dia']}</td>
<td>{$resultados['descripcion']}</td>
<td>
$borrar_html
</td>
</tr>";
} else {
echo "<br/>No hay mas datos<br/>";
}
}
echo "<table>
<tr>
<th>Asignatura</th>
<th>Dia</th>
<th>Descripcion</th>
<th>Accion</th>
</tr>";
mostrarDatos($fila);
}
?>
</body>
</html>